TUTORIAL后端与 Web 服务FETCHED

ASP Line 属性

ASP Line 属性 完整的 TextStream 对象参考手册 Line 属性返回在 TextStream 文件中的当前行号(从 1 开始)。 语法 TextStreamObject.Line 实例 <% dim fs,f,t set fs=Server.CreateObject('Scripting.FileSystemObject') set f=fs.CreateTextF..

更新于 2026/7/16

教程详情页默认 noindex。

ASP Line 属性


TextStream 对象参考手册 完整的 TextStream 对象参考手册

Line 属性返回在 TextStream 文件中的当前行号(从 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
%>

输出:

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


TextStream 对象参考手册 完整的 TextStream 对象参考手册