EndOfFile

From SCAR Divi Manual
Revision as of 23:23, 2 November 2011 by Freddy (talk | contribs)
Jump to: navigation, search

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