LOF() function - MapBasic - 2023

MapInfo MapBasic Reference

Product type
Software
Portfolio
Locate
Product family
MapInfo
Product
MapInfo > MapBasic
Version
2023
Language
English
Product name
MapBasic
Title
MapInfo MapBasic Reference
First publish date
1985
Last updated
2023-09-12
Published on
2023-09-12T16:32:32.686312

Purpose

Returns the length of an open file.

Syntax

LOF( filenum ) 

filenum is the number of an open file.

Return Value

LargeInt value

Description

The LOF() function returns the length of an open file, in bytes.

The file parameter represents the number of an open file; this is the same number specified in the As clause of the Open File statement.

Error Conditions

ERR_FILEMGR_NOTOPEN (366) error generated if the specified file is not open.

Example

Dim size As Integer
Open File "import.txt" For Binary As #1 
size = LOF(1)
' size now contains the # of bytes in the file

See Also:

Open File statement