FileSize function
Size of file.
Declaration
function FileSize(var f: File): Int64Description
Filesize returns the total number of records in file
F.
It cannot be invoked with a file of type
Text. (under Linux and Unix, this
also means that it cannot be invoked on pipes).
If
F is empty, 0 is returned. Untyped files have a default record
size of 128, if the second parameter to
Reset isn't specified.
Note that the file must be open for this function to return a result.
Errors
Depending on the state of the
{$I} switch, a runtime error can be
generated if there is an error. In the
{$I-} state, use
IOResult
to check for errors.
See also
Example: ex24
Program Example24;
{ Program to demonstrate the FileSize function. }
Var F : File Of byte;
L : File Of Longint;
begin
Assign (F,paramstr(1));
Reset (F);
Writeln ('File size in bytes : ',FileSize(F));
Close (F);
Assign (L,paramstr (1));
Reset (L);
Writeln ('File size in Longints : ',FileSize(L));
Close (f);
end.An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
