EOF is a pre-defined name indica
ting that the end of file has been reached on the current input stream. All stream input primitives, such as READ, READCHAR, READLINE, READLIST, or READQUOTE, output :EOF if the stream from which they are reading reaches the end of a file. If an attempt is made to read characters past the end of a file, an error message displays. The default value of "EOF is EOF.
Example
The procedure below reads every character from a file the end of file marker is reached. Thus, the file is checked for bad sectors or other hardware problems.
TO SCAN :FILE
- IF NOT FILE? :FILE THEN (PRINT :FILE [DOES NOT EXIST]) STOP
- MAKE "OLDSTREAM :STANDARD.INPUT
- MAKE "STANDARD.INPUT OPEN :FILE
- SCAN.CHARS
- CLOSE :STANDARD.INPUT
- MAKE "STANDARD.INPUT :OLDSTREAM
END
TO SCAN.CHARS
- IF EQUAL? RC :EOF THEN STOP
- SCAN.CHARS
END