Tests whether the file position is at the end of a file.
function Eof: Boolean; overload; function Eof(var F): Boolean; overload; function Eof(var F: Text): Boolean; overload;
Boolean Eof(); Boolean Eof( F); Boolean Eof(Text F);
System
In Delphi code, Eof tests whether the current file position is the end-of-file. F is a file variable that has been opened for reading. If F is omitted, the standard file variable Input is assumed.
Eof(F) returns true if the current file position is beyond the last character of the file or if the file is empty; otherwise, Eof(F) returns false.
Delphi Examples:
{ This example reads a file one character at a time and writes it into a file of your chosing. } procedure TForm1.Button1Click(Sender: TObject); var F1, F2: TextFile; Ch: Char; begin if OpenDialog1.Execute then begin AssignFile(F1, OpenDialog1.Filename); Reset(F1); if SaveDialog1.Execute then begin AssignFile(F2, SaveDialog1.Filename); Rewrite(F2); while not Eof(F1) do begin Read(F1, Ch); Write(F2, Ch); end; CloseFile(F2); end; CloseFile(F1); end; end;
Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
|
What do you think about this topic? Send feedback!
|