1
1
Fork 0
mirror of https://github.com/QB64-Phoenix-Edition/QB64pe.git synced 2024-07-04 04:50:22 +00:00
QB64-PE/internal/help/LOF_111.txt
Roland Heyder aeb9c0668b Updates help files for use with new Wiki parser (2nd try)
Note: Many files were removed (not yet existing/empty pages). The parser will try to download them on demand and will auto-generate text for missing pages (eg. most _gl pages).
2022-05-21 00:18:31 +02:00

34 lines
990 B
Plaintext

{{QBDLDATE:05-20-2022}}
{{QBDLTIME:23:14:16}}
The [[LOF]] function is used to find the length of an [[OPEN]] file in bytes.
{{PageSyntax}}
: ''totalBytes&'' = [[LOF]]([#]{{Parameter|fileNumber}})
{{PageDescription}}
* LOF returns the number of bytes in an [[OPEN]]ed designated {{Parameter|fileNumber}}. File is empty if it returns 0.
* {{Parameter|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 9 GB (9,223,372,036 bytes) file sizes.
{{PageExamples}}
''Example:'' Finding the number of records in a RANDOM file using a [[TYPE]] variable.
{{CodeStart}}
OPEN file$ FOR RANDOM AS #1 LEN = {{Cl|LEN}}(Type_variable)
NumRecords% = {{Cl|LOF}}(1) \ RecordLEN%
{{CodeEnd}}
{{PageSeeAlso}}
* [[LEN]], [[EOF]], [[BINARY]], [[RANDOM]], [[TYPE]]
{{PageNavigation}}