Lof Function

Purpose

Determines the length of a file.

Syntax

large = Lof(#n)

long = Lof%(#n)

Description

Lof[%](#n) works only on a file previously opened with Open though the channel n and returns its length in bytes (length of file).

Lof() returns a 64-bit integer and is suited for files sizes of 4 GB.

Lof%() returns a 32-bit integer and is suited for files sizes with a maximum size of 2 GB.

Example

OpenW # 1

Open "c:\Test.Dat" for Output As # 1

Print # 1, String$(200, "A")

Close # 1

Open  "c:\Test.Dat" for Input As # 1

Print "File length in bytes: "; LOF(# 1) // Prints 200

Close # 1

Opens file TEST.DAT in current directory and returns its size.

Remarks

The functions Loc%(), Lof%(), Record%#, Seek%#, RelSeek%# etc. always use 32 bits integers and are therefore limited to files with a maximum size of 2 GB. (VB compatibility)

See Also

Eof(), Loc(), Record#, Seek#, RelSeek#

{Created by Sjouke Hamstra; Last updated: 12/10/2014 by James Gaite}