ASP Line 属性

定义和用法

Line 属性返回在 TextStream 文件中的当前行号(从 1 开始)。

语法:

  1. TextStreamObject.Line

实例

  1. <%
  2. dim fs,f,t
  3. set fs=Server.CreateObject("Scripting.FileSystemObject")
  4. set f=fs.CreateTextFile("c:\test.txt",true)
  5. f.WriteLine("Hello World!")
  6. f.WriteLine("How are you today?")
  7. f.WriteLine("Goodbye!")
  8. f.close
  9.  
  10. Set t=fs.OpenTextFile("c:\test.txt",1)
  11. do while t.AtEndOfStream=false
  12. Response.Write("Line " & t.Line & ": ")
  13. Response.Write(t.ReadLine)
  14. Response.Write("<br>")
  15. loop
  16. t.Close
  17. %>

输出:

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