Eof: Boolean;
The Eof property returns whether end of a file text is reached.
Sub Main;
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;
While Not TextR.Eof Do
Word.Add(TextR.ReadWord);
End While;
End If;
Dispose File1;
End Sub Main;
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.
See also: