
|
Property:
TextStream.Line
object.Line
Used to return the current line number in a text file. Upon opening a textfile and before any writing takes place, Line always returns '1'.
Code:
<% dim filesys, text, readfile, contents, col, linumber
set filesys =
CreateObject("Scripting.FileSystemObject")
Set text = filesys.CreateTextFile("c:\somefile2.txt")
text.Write "Find the last character in the text file"
text.close
set readfile = filesys.OpenTextFile("c:\somefile2.txt", 1, false)
do while readfile.AtEndOfStream <> true
contents = readfile.Read(1) col =
readfile.Column -1
linumber = readfile.Line
loop
readfile.close
Response.Write "The last character
in line " & linumber & " is '" & contents & "' and_
it's
column number is '" & col & "'."
%>
Output:
"The last character in line 1 is 'e' and it's column number is '40'."
Copyright 1999 by Infinite Software Solutions, Inc.
Trademark Information
|