BASIC FUNCTIONS SECTION 5.6
5.6.3
Function EOF checks for end of file.
Syntax EOF(file no)
ExruJ4>les 10 OPEN "DATA.TXT" FOR INPUT AS 111
20 INPUT/11,A,B,C
30 PRINT A,B,C
40 IF EOF(1)THEN CLOSE 111 ELSE GOTO 20
50 PRINT"END OF FILE": END
Remarks EOF = -1 if end of file has been reached
EOF
= 0 if more data is in the file
Programs should not try to read beyond the end of a file
since an error will occur.
NOTE: The file DATA.TXT used in this example, could be
created by a Basic program of the form:
100 OPEN "DATA. TXT
11
FOR OUTPUT AS 111
110 WRITE/11, 123,235,345
120 CLOSE/11
130 END
This will ensure that the correct end of file marker is
written to the file.
VER.V09F
PAGE 5 - 31