Scripting Runtime Library  

AtEndOfStream Property

Returns true if the file pointer is at the end of a TextStream file; false if it is not. Read-only.


The object is always the name of a TextStream object.


The AtEndOfStream property applies only to TextStream files that are open for reading, otherwise, an error occurs.

The following code illustrates the use of the AtEndOfStream property:

function GetALine(filespec)
   var fso, f, s, ForReading;
   ForReading = 1, s = "";
   fso = new ActiveXObject("Scripting.FileSystemObject");
   f = fso.OpenTextFile(filespec, ForReading, false);
   while (!f.AtEndOfStream)
      s += f.ReadLine( );
   f.Close( );
Function ReadEntireFile(filespec)
   Const ForReading = 1
   Dim fso, theFile, retstring
   Set fso = CreateObject("Scripting.FileSystemObject")
   Set theFile = fso.OpenTextFile(filespec, ForReading, False)
   Do While theFile.AtEndOfStream <> True
      retstring = theFile.ReadLine
   ReadEntireFile = retstring
End Function

See Also

AtEndOfLine Property

Applies To: TextStream Object