LOF Function

Description

Returns the size, in bytes, of a file opened using the Open statement.

Syntax

LOF(filenumber)

The filenumber named argument is any valid file number.

Remarks

To obtain the length of a file that is not open, use the FileLen function.

See Also

EOF Function, FileLen Function, Loc Function, Open Statement.

Example

This example uses the LOF function to determine the size of an open disk file. For purposes of this example, assume that TESTFILE is a text file containing sample data.


Open "TESTFILE" For Input As #1    ' Open file.
FileLength = LOF(1)    ' Get length of file.
Close #1    ' Close file.