Difference between revisions of "EndOfFile"

From SCAR Divi Manual
Jump to: navigation, search
(Created page with "==Definition== <source lang="scar" lines="false"> function EndOfFile(FileNum: Integer): Boolean; </source> ==Availability== SCAR Divi 3.00 > Current ==Description== Returns [[t...")
 
 
(2 intermediate revisions by the same user not shown)
Line 30: Line 30:
 
end.
 
end.
 
</source>
 
</source>
 +
 +
Output:
 +
0
 +
1
  
 
==See Also==
 
==See Also==

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