SoFunction
Updated on 2025-04-11

VBS tutorial: Attributes - AtEndOfStream attributes

AtEndOfStream property

If the file pointer is locatedTextStreamAt the end of the file, returnTrue; otherwise, if not read-only, returnFalse

object.AtEndOfStream

object should be the name of the TextStream object.

illustrate

AtEndOfStreamProperties are only used for open read-onlyTextStreamfile, otherwise an error will occur.

The following code shows how to use itAtEndOfStreamproperty:

Function ReadEntireFile(filespec)  Const ForReading = 1  Dim fso, theFile, retstring  Set fso = CreateObject("")  Set theFile = (filespec, ForReading, False)  Do While theFile.AtEndOfStream <> True    retstring =   Loop    ReadEntireFile = retstringEnd Function