Difference between revisions of "EndOfFile"

From SCAR Divi Manual
Jump to: navigation, search
 
Line 38: Line 38:
 
*[[FileSize]]
 
*[[FileSize]]
 
*[[OpenFile]]
 
*[[OpenFile]]
*[[AppendFile]]
 
 
*[[CloseFile]]
 
*[[CloseFile]]
  
 
[[Category:Functions]]
 
[[Category:Functions]]
 
[[Category:File Functions]]
 
[[Category:File Functions]]

Latest revision as of 00:23, 3 November 2011

Definition

function EndOfFile(FileNum: Integer): Boolean;

Availability

SCAR Divi 3.00 > Current

Description

Returns true if your position in the file stream associated with the index FileNum in the file stream resource manager is at the end of the stream. This is always true when writing a file in SCAR Divi and only true when you have read the entire file when reading.

Example

var
  f: Integer;
  s: string;

begin
  f := Rewritefile(LogsPath + 'Test.txt', False);
  WriteFileString(f, 'Hello World!');
  CloseFile(f);

  f := OpenFile(LogsPath + 'Test.txt', False);
  WriteLn(EndOfFile(f));
  ReadFileString(f, s, FileSize(f));
  WriteLn(EndOfFile(f));
  CloseFile(f);

  DeleteFile(LogsPath + 'Test.txt');
end.

Output:

0
1

See Also