LOF
l = LOF (fileN)
Returns the length l
of a file with the file handle
fileN
in bytes. For other devices, returns the number of
available data.
Example 1: Length of a file
' create a text file
open "MyDemoFile.txt" for output as #1
for i = 1 to 10
bputc #1, i
next
close #1
' open text file and print content byte by byte
open "MyDemoFile.txt" for input as #1
LOF(1) ' lof works only without #
FileLength =
for ii = 1 to FileLength
bgetc(1)
c = print c
next
close #1
Example 2: Get available data for a socket connection
open "SOCL:10000" as #1 ' Open socket at port 10000
while (eof(1)) ' Loop until connection is closed
lof(1) ' Querry how much data is in the queue
l = if(l) then ' if data is available
INPUT(l, #1) ' get all data
s = print s
endif
wend
close #1
Code samples using LOF
File
ACCESS
BGETC
BLOAD
BPUTC
BSAVE
CHDIR
CHMOD
CLOSE
COPY
DIRWALK
EOF
EXIST
FILES
FREEFILE
INPUT
INPUT
KILL
LOCK
LOF
MKDIR
OPEN
READ
RENAME
RMDIR
SEEK
SEEK
TLOAD
TSAVE
WRITE
If there is insufficient information on this page and you wish learn more about LOF,
please send an email to smallbasic@gmail.com. You can help to improve information about
LOF by submitting a pull request,
click View Source for details. Note, an offline language reference text file is also available - see the Download section.