源代码:
This is all the lines in the text file (with line numbers):
<% Set fs=Server.CreateObject("Scripting.FileSystemObject") Set f=fs.OpenTextFile(Server.MapPath("testread.txt"), 1) do while f.AtEndOfStream = false Response.Write("Line:" & f.Line & " ") Response.Write(f.ReadLine) Response.Write("
") loop f.Close Set f=Nothing Set fs=Nothing %>
运行结果:
This is all the lines in the text file (with line numbers):
<% Set fs=Server.CreateObject("Scripting.FileSystemObject") Set f=fs.OpenTextFile(Server.MapPath("testread.txt"), 1) do while f.AtEndOfStream = false Response.Write("Line:" & f.Line & " ") Response.Write(f.ReadLine) Response.Write("
") loop f.Close Set f=Nothing Set fs=Nothing %>