qbasic.hlp (Topic list)
EOF Function
  Contents  Index  Back
──────────────────────────────────────────────────────────────────────────────
Tests for the end of a file. EOF returns true (nonzero) if the end of a file
has been reached.
 
EOF(filenumber%)
 
    ■ filenumber%    The number of an open file.
 
Example:
    CLS
    OPEN "TEST.DAT" FOR OUTPUT AS #1
    FOR i% = 1 TO 10
        WRITE #1, i%, 2 * i%, 5 * i%
    NEXT i%
    CLOSE #1
    OPEN "TEST.DAT" FOR INPUT AS #1
    DO
        LINE INPUT #1, a$
        PRINT a$
    LOOP UNTIL (EOF(1))
 
See Also    CLOSE    LOC    LOF    OPEN