LOF - QB64 Wiki

LOF

From QB64 Wiki

Jump to: navigation, search

The LOF Function is used to find the length of an OPEN file in bytes.


Syntax:

bytes = LOF(filenumber)


  • LOF returns the number of bytes in an OPENed designated filenumber. File is empty if it returns 0.
  • Filenumber is the number of the opened file. # is not required.
  • Often used to determine the number of records in a RANDOM access file.
  • Can also be used to avoid reading an empty file, which would create an error.
  • LOF in QB64 can return up to 9223372036 gigabyte file sizes.


Example: Finding the number of records in a RANDOM file using a TYPE variable.

OPEN file$ FOR RANDOM AS #1 LEN = LEN(Type_variable) NumRecords% = LOF(1) \ RecordLEN%


See Example: INPUT (file mode)


See also:



Navigation:
Go to Keyword Reference - Alphabetical
Go to Keyword Reference - By usage
Go to Main WIKI Page
Views
  • Page
  • Discussion
  • View source
  • History
Personal tools
  • Log in
Toolbox
  • What links here
  • Related changes
  • Special pages
  • Printable version