qbasic.hlp (Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
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