Input / Output

KEY 2.1.1 Reading in Programs 2.1.2 File Handling 2.1.3 Input and Output of Terms 2.1.4 Character Input/Output A total of ten I/O streams may be open at any one time for input and output. This includes a stream that is always available for input and output to the user's terminal. A stream to a file F is opened for input by the first see(F) executed. F then becomes the current input stream. Similarly, a stream to file H is opened for output by the first tell(H) executed. H then becomes the current output stream. Subsequent calls to see(F) or to tell(H) make F or H the current input or output stream, respectively. Any input or output is always to the current stream. When no input or output stream has been specified, the standard ersatz file 'user', denoting the user's terminal, is utilised for both. When the terminal is waiting for input on a new line, a prompt will be displayed as follows: "| " - top-level continuation line. "| " - during consult(user). "|: " - default for read from user program. When the current input (or output) stream is closed, the user's terminal becomes the current input (or output) stream. No file except the ersatz file 'user' can be simultaneously open for input and output. A file is referred to by its name, written as an atom, e.g. myfile 'F123' 'DATA#LST' 'ecmi25.greeks' All I/O errors normally cause an abort, except for the effect of the evaluable predicate nofileerrors decribed below. End of file is signalled on the user's terminal by issuing a ^Y (Control and Y) character. Any more input requests for a file whose end has been reached causes an error failure.