From Clomosy Docs
function Eof(TextFile);
The Eof function returns true if the file given by FileHandle is at the end.
The file must have been assigned, and opened with Reset.
Example:
var myFile : TextFile;
begin AssignFile(myFile, 'Test.txt'); ReWrite(myFile);
WriteLn(myFile, 'Hello'); WriteLn(myFile, 'World'); CloseFile(myFile); Reset(myFile);
while not Eof(myFile) do begin ReadLn(myFile); end;
CloseFile(myFile); end;