From Clomosy Docs
(Created page with " function Eof(TextFile); The Eof function returns true if the file given by FileHandle is at the end.<br> The file must have been assigned, and opened with Reset. '''Example:'''<br> '''var''' myFile : TextFile;<br> '''begin''' AssignFile(myFile, 'Test.txt'); ReWrite(myFile);<br> WriteLn(myFile, 'Hello'); WriteLn(myFile, 'World'); CloseFile(myFile); Reset(myFile);<br> while not '''Eof'''(myFile) do begin ReadLn(myFile); end;<br> Cl...") |
No edit summary |
||
| Line 4: | Line 4: | ||
'''Example:'''<br> | '''Example:'''<br> | ||
:'''Base Syntax''' | |||
var | |||
myFile : TextFile;<br> | myFile : TextFile;<br> | ||
begin | |||
AssignFile(myFile, 'Test.txt'); | AssignFile(myFile, 'Test.txt'); | ||
ReWrite(myFile);<br> | ReWrite(myFile);<br> | ||
| Line 18: | Line 19: | ||
end;<br> | end;<br> | ||
CloseFile(myFile); | CloseFile(myFile); | ||
''' | end; | ||
:'''TRObject Syntax''' | |||
var | |||
myFile : TextFile; | |||
{ | |||
AssignFile(myFile, 'Test.txt'); | |||
ReWrite(myFile); | |||
WriteLn(myFile, 'Hello'); | |||
WriteLn(myFile, 'World'); | |||
CloseFile(myFile); | |||
Reset(myFile); | |||
while (not '''Eof'''(myFile)) | |||
{ | |||
ReadLn(myFile); | |||
} | |||
CloseFile(myFile); | |||
} | |||
Revision as of 11:28, 13 February 2024
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:
- Base Syntax
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;
- TRObject Syntax
var
myFile : TextFile;
{
AssignFile(myFile, 'Test.txt');
ReWrite(myFile);
WriteLn(myFile, 'Hello');
WriteLn(myFile, 'World');
CloseFile(myFile);
Reset(myFile);
while (not Eof(myFile))
{
ReadLn(myFile);
}
CloseFile(myFile);
}