Name

AtEndOfLine (TextStream Object) — tsObj .AtEndOfLine

Synopsis

A Boolean value that indicates whether the file pointer is at the end of the current line. This is a read-only property.

Parameters

None

Example

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]

%>

Notes

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.

Get ASP in a Nutshell, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.