ITextReader.Eof

Syntax

Eof: Boolean;

Description

The Eof property returns whether end of a file text is reached.

Example

Sub UserProc;
Var
    File1: IFileInfo;
    TextR: ITextReader;
    Word: IStringList;
Begin
    File1 := New FileInfo.Attach("c:\New_folder\1.txt");
    Word := New StringList.Create;
    If File1.Exists Then
        TextR := File1.OpenTextReader;
        TextR.Encoding := CodePage.UTF8;
        While Not TextR.Eof Do
            Word.Add(TextR.ReadWord);
        End While;
    End If;
    Dispose File1;
End Sub UserProc;

After executing the example an array of words read from the 1.txt file is located in the Word variable. A space is used as a separator between words. UTF-8 encoding is used when working with file.

See also:

ITextReader