ReadFileInt

From SCAR Divi Manual
Revision as of 13:28, 4 July 2011 by Freddy (talk | contribs) (Created page with "==Definition== <source lang="scar" lines="false"> function ReadFileInt(FileNum: Integer; var i: Integer): Boolean; </source> ==Availability== SCAR Divi 3.00 > Current ==Descrip...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Definition

function ReadFileInt(FileNum: Integer; var i: Integer): Boolean;

Availability

SCAR Divi 3.00 > Current

Description

Reads an integer from an open file stream associated with the index FileNum in the file stream resource manager and returns it in i. Returns false if the reading failed or the index FileNum is invalid. The file stream should have been created with OpenFile.

Example

var
  f, i: Integer;

begin
  f := Rewritefile(LogsPath + 'Test.txt', False);
  WriteFileInt(f, 12345);
  CloseFile(f);

  f := OpenFile(LogsPath + 'Test.txt', False);
  ReadFileInt(f, i);
  WriteLn(i);
  CloseFile(f);

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

Output:

12345

See Also