From Liberty BASIC Family
Jump to navigation Jump to search
Supported in Just BASIC Supported in Liberty BASIC Not supported in Liberty BASIC 5 Not supported in Run BASIC


Returns the "length of file" as the number of bytes in the file referenced by #handle.


  1. lof(#handle)


On file bigger then 4 Gb (2^32 bytes), lof(#handle) erroneously returns truncated value: actual_length MOD 2^32. In that case, FILES command allows to read right value.


' Assumes file named "test.txt" exists on disk:
open "test.txt" for input as #1

' input$(#handle, n) returns the number of characters specified by the argument n.
' Therefore, the number of characters to return will be the length of the file in bytes.
txt$ = input$(#1, lof(#1))
print "Contents of file: "
print txt$
close #1

Useful Procedures

' Place a useful function or sub using this keyword here