最新的Web开发教程
 

ASP Line Property


<完整文本流对象参考

行属性返回一个文本流文件当前行号(starting at 1)

句法

TextStreamObject.Line

<%
dim fs,f,t
set fs=Server.CreateObject("Scripting.FileSystemObject")
set f=fs.CreateTextFile("c:\test.txt",true)
f.WriteLine("Hello World!")
f.WriteLine("How are you today?")
f.WriteLine("Goodbye!")
f.close

Set t=fs.OpenTextFile("c:\test.txt",1)
do while t.AtEndOfStream=false
  Response.Write("Line " & t.Line & ": ")
  Response.Write(t.ReadLine)
  Response.Write("<br>")
loop
t.Close
%>

Output:

Line 1: Hello World!
Line 2: How are you today?
Line 3: Goodbye!

<完整文本流对象参考