LOF Function

Named Arguments

No

Syntax

LOF(filenumber)


filenumber

Use: Required

Data Type: Integer

Any valid file number.

Return Value

A Long integer.

Description

Returns the size of an open file in bytes.

Rules at a Glance

filenumber must be the number of a file opened using the Open statement.

Example

The following example shows how to use the LOF function to determine the length of a data file and to determine the number of records it contains:

Open sFileName For Random As #iFile Len = Len(udtCustomer)
iMaxRecs = LOF(iFile) / Len(udtCustomer)
For iRec = 1 To iMaxRecs   
   Get #1, iRec, udtCustomers(iRec)
Next iRec
Close #iFile

Programming Tips and Gotchas

LOF works only on an open file; if you need to know the size of a file that isn't open, use the FileLen function.

See Also

FileLen Function
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset