[Overview][Constants][Types][Classes][Procedures and functions][Variables] |
Check for end of file
Source position: line 0
function EOF( |
var f: File |
):Boolean; |
var t: Text |
):Boolean; |
Eof returns True if the file-pointer has reached the end of the file, or if the file is empty. In all other cases Eof returns False. If no file F is specified, standard input is assumed.
Depending on the state of the \var{\{\$I\}} switch, a runtime error can be generated if there is an error. In the \var{\{\$I-\}} state, use IOResult to check for errors.
|
Check for end of line |
|
|
Assign a name to a file |
|
|
Open file for reading |
|
|
Open file for writing |
Program Example18; { Program to demonstrate the Eof function. } Var T1,T2 : text; C : Char; begin { Set file to read from. Empty means from standard input.} assign (t1,paramstr(1)); reset (t1); { Set file to write to. Empty means to standard output. } assign (t2,paramstr(2)); rewrite (t2); While not eof(t1) do begin read (t1,C); write (t2,C); end; Close (t1); Close (t2); end.