Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
FileSize Function
◄Summary► ◄Details► ◄Example► ◄Back►
Argument
file_variable Open typed or untyped file
Returns
LongInt Number of components in file: for typed file,
number of records; for untyped file, number of
blocks
Description
The FileSize function returns the size of an open typed or untyped
file. The value returned equals the end-of-file position for the
file. FileSize returns 0 if the file is empty.
For a typed file, the returned value represents the number of
records in the file.
For an untyped file, the returned value represents the number of
blocks in the file. An untyped file has a default block size of 128
bytes. The size argument in Reset and Rewrite sets the block size.
If the file size is not a multiple of the block size, FileSize
returns the number of whole blocks in the file.
FileSize applies to open typed or untyped files. It does not accept
a text file variable. To use FileSize on a text file, declare
file_variable as FILE OF Char and assign it to the text file.
If file_variable is not associated with a file or if the file is
not open when FileSize is called, an I/O error occurs.
To prevent a program from halting with a run-time error when an I/O
error occurs, turn off I/O checking with {$I-} and check the return
value of the IOResult function.