时间:2021-05-18
Ever want to know how to display the contents of a text document using ASP. Here is a easy way to read
from a text file
<!--Start of ASP Code---->
<%
'by James Seymour, http://jamesdot.org
Dim write
Dim fileSysObj, tf, read
' Read the read.txt
' Store the file name where the Information is stored into a variable called read
read = "read.txt"
' Retrieve the fullpath of the read file
read = LEFT(Server.Mappath(Request.ServerVariables("PATH_INFO")), InStrRev(Server.Mappath
(Request.ServerVariables("PATH_INFO")), "\")) & read
' Create an instance of FileSystem Object and store it into a variable called fileSysObj
Set fileSysObj = createObject("Scripting.FileSystemObject")
' Check whether the read file exists
IF (fileSysObj.FileExists(read)) Then
' if the file exists, then open it for reading
Set tf = filesysobj.OpenTextFile(read, 1)
read = tf.ReadLine
tf.Close
ELSE
' if you can't find read.text, display default message
read = "I can't find the file read.txt! So this is my default message."
END IF
%>
' table the displays the read.txt file
<div align="center">
<center>
<table border="0" width="40%" cellspacing="0" cellpadding="0">
<tr>
<td width="100%" bgcolor="#EEEECC"><B><%=read%></B>
</td>
</tr>
<tr>
<td width="100%">
<!-- End of the ASP -->
use the code above, click and drag your mouse over the code to highlight it. Then right click on the
highlighted code and click "Copy." Now you may paste it into your code editor.
声明:本页内容来源网络,仅供用户参考;我单位不保证亦不表示资料全面及准确无误,也不保证亦不表示这些资料为最新信息,如因任何原因,本网内容或者用户因倚赖本网内容造成任何损失或损害,我单位将不会负任何法律责任。如涉及版权问题,请提交至online#300.cn邮箱联系删除。
本文实例讲述了C#处理文本文件TXT的方法。分享给大家供大家参考。具体分析如下:1.如何读取文本文件内容:这里介绍的程序中,是把读取的文本文件,用一个richT
读取文本文件中的内容此示例读取文本文件的内容以使用System.IO.File选件类的静态方法ReadAllText和ReadAllLines。classRea
visualstdio一般都是会编辑c语言来读取文本文件的内容,今天我们就来看看VisualStudio读取文本文件的教程。软件名称:微软VisualStudi
fileinput模块提供处理一个或多个文本文件的功能,可以通过使用for循环来读取一个或多个文本文件的所有行。它的工作方式和readlines很类似,不同点在
从文本文件中读取数据(import)常用的文本文件:CSV(CommaSeparatedValues)文件,即:以逗号分隔的数值形式如下:[plain]M000