EndOfFile

From SCAR Divi Manual
Revision as of 11:15, 1 July 2011 by Freddy (talk | contribs) (Created page with "==Definition== <source lang="scar" lines="false"> function EndOfFile(FileNum: Integer): Boolean; </source> ==Availability== SCAR Divi 3.00 > Current ==Description== Returns [[t...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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.

See Also