EOF
EOF (fileN)
Returns true if the file pointer is at end of the file. For serial
port (RS232) and TCP/IP socket connection EOF
returns true
if the connection is broken. For socket connection the return value
ofEOF
will be updated every time data is recieved or
send.
Example 1: Reading data from a file
' create a text file
open "MyDemoFile.txt" for output as #1
for i = 1 to 10
print #1, i
next
close #1
' open text file and print content line by line
open "MyDemoFile.txt" for input as #1
while(!eof(1)) ' eof works only without #
input #1, c
print c
wend
close #1
Example 2: Reading from a TCP/IP socket
rem Print a date string like '29 SEP 2018 09:31:49 ACST'
func get_time
local today = julian(date)
local start = timer
local t_hour, t_min, t_sec, t_str
timehms start, t_hour, t_min, t_sec
rem TODO, format should support multiple arguments
format(" ##:", t_hour) + format("##:", t_min) + format("##", t_sec)
t_str = return datefmt("dd mmm yyyy", today) + t_str
end
while 1
open "SOCL:8080" as #1
while (not eof(1))
lineinput #1, s
if (s == "time")
print #1, get_time
else
print #1, "unknown command"
endif
wend
close #1
wend
Code samples using EOF
3d_palmx.bas
4tune.bas
agendus.bas
coordplot.bas
demanda.bas
drawpoly.bas
duckduckgo.bas
form demo.bas
g2 Life.bas
g3 Life.bas
g4 Life.bas
g5 Life.bas
g6 Life.bas
gaptest.bas
irc-bot.bas
new help.bas
palm_cli.bas
palmcli.bas
screensv_ld_compres.bas
star worlds.bas
stars.bas
swirl2.bas
tabs2spaces.bas
TinyBASIC.bas
tracklog.bas
typewriter with sound effects.bas
typewriter.bas