Skip to content
Paul Squires edited this page Oct 19, 2026 · 2 revisions

Home › File I/O Functions › LOF

LOF

Returns the length in bytes of an open file.

Syntax

Declare Function LOF ( ByVal filenum As Long ) As LongInt

Parameters

  • filenum

Description

Returns the length, in bytes, of a file opened previously with Open using the given filenum.

With Open Com it returns the length of the data pending to be read in the receive buffer.

Return Value

The length in bytes of an open disk file.

Remarks

Usage

result = LOF( filenum )

Differences from QB

  • None

See also

Examples

Dim f As Long

f = FreeFile

Open "file.ext" For Binary As #f

Print LOF(f)

Close #f

Category: File I/O Functions
Kind: function


Reproduced from the FreeBASIC Wiki Manual under the GNU Free Documentation License 1.3 — with no Invariant Sections, no Front-Cover Texts and no Back-Cover Texts. Copyright © the FreeBASIC project and wiki contributors. See License.

Clone this wiki locally