July 2000
Intermediate to advanced
492 pages
14h 53m
English
AtEndOfLine (TextStream Object) —
tsObj
.AtEndOfLine
A Boolean value that indicates whether the file pointer is at the end of the current line. This is a read-only property.
None
The following code instantiates a FileSystemObject and a TextStream object. It then uses the Read method to read one character at a time until the end of the line is reached. Notice that the use of the AtEndOfStream and AtEndOfLine properties are identical.
<%
' Set up constants.
Const constForReading = 1
Const constTristateFalse = 0
' Dimension local variables.
Dim fsoObject ' FileSystemObject
Dim tsObject ' TextStream Object
Dim strReturned ' String variable to hold file contents
' Instantiate the FileSystemObject variable.
Set fsoObject = Server.CreateObject( _
"Scripting.FileSystemObject")
' Using the OpenTextFile method of fsoObject,
' create a text file.
Set tsObject = _
fsoObject.OpenTextFile("d:\docs\test.txt", _
constForReading, constTristateFalse)
' Read one character at a time until the end of the
' line has been reached.
Do While Not tsObject.AtEndOfLine
StrReturned = strReturned & tsObject.Read(1)
Loop
. . . [additional code]
%>If you attempt to use the AtEndOfLine property with a text file opened for any purpose other than reading, you will receive an error.
The AtEndOfLine property will not inform you that you have reached the end of the file.
Read now
Unlock full access