Property: AtEndOfStream for TextStream
- Updated2024-09-12
- 1 minute(s) read
FileSystemObject and Dictionary > Properties > Property: AtEndOfStream for TextStream
Property: AtEndOfStream for TextStream
Checks whether the read pointer is just before the end of the file of a TextStream file.
Object.AtEndOfStream
| Object | TextStream Object with this property |
| Object.AtEndOfStream | Boolean value with read access The value is True if the read pointer is before the end of file character, otherwise the value is False. |
The following example reads in a file line by line to the end of the file:
Function ReadFile(sFile) Const ForReading = 1 Dim fso, oMyFile, sOutput Set fso = CreateObject("Scripting.FileSystemObject") Set oMyFile = fso.OpenTextFile(sFile, ForReading, False) Do While oMyFile.AtEndOfStream <> True sOutput = sOutput & oMyFile.ReadLine & VBCrLf Loop oMyFile.Close ReadFile = sOutput End Function