The DEC-10 Prolog I/O predicates manipulate streams implicitly since they only refer to current input/output streams (section 7.10.1). The current input and output streams are initially set to user_input and user_output respectively. The predicate see/1 (resp. tell/1, append/1) can be used for setting the current input (resp. output) stream to newly opened streams for particular files. The predicate seen/0 (resp. told/0) close the current input (resp. output) stream, and resets it to the standard input (resp. output). The predicate seeing/1 (resp. telling/1) is used for retrieving the file name associated with the current input (resp. output) stream. The file name user stands for the standard input or output, depending on context (user_input and user_output can also be used). The DEC-10 Prolog I/O predicates are only provided for compatibility, they are now obsolete and their use is discouraged. The predicates for explicit stream manipulation should be used instead (section 7.10).
Templates
Description
see(FileName) sets the current input stream to FileName. If there is a stream opened by see/1 associated with the same FileName already, then it becomes the current input stream. Otherwise, FileName is opened for reading and becomes the current input stream.
tell(FileName) sets the current output stream to FileName. If there is a stream opened by tell/1 associated with the same FileName already, then it becomes the current output stream. Otherwise, FileName is opened for writing and becomes the current output stream.
append(FileName) like tell/1 but FileName is opened for writing + append.
A stream-term (obtained with any other built-in predicate) can also be provided as FileName to these predicates.
Errors
See errors associated with open/4 (section 7.10.6).
Portability
GNU Prolog predicates.
Templates
Description
seeing(FileName) succeeds if FileName unifies with the name of the current input file, if it was opened by see/1; else with the current input stream-term, if this is not user_input, otherwise with user.
telling(FileName) succeeds if FileName unifies with the name of the current output file, if it was opened by tell/1 or append/1; else with the current output stream-term, if this is not user_output, otherwise with user.
Errors
None.
Portability
GNU Prolog predicates.
Templates
Description
seen closes the current input, and resets it to user_input.
told closes the current output, and resets it to user_output.
Errors
None.
Portability
GNU Prolog predicates.
Templates
Description
get0(Code) succeeds if Code unifies with the next character code read from the current input stream. Thus it is equivalent to get_code(Code) (section 7.12.1).
get(Code) succeeds if Code unifies with the next character code read from the current input stream that is not a layout character.
skip(Code) skips just past the next character code Code from the current input stream.
Errors
See errors for get_code/2 (section 7.12.1).
Portability
GNU Prolog predicates.
Templates
Description
put(Code) writes the character whose code is Code onto the current output stream. It is equivalent to put_code(Code) (section 7.12.5).
tab(N) writes N spaces onto the current output stream. N may be an arithmetic expression.
Errors
See errors for put_code/2 (section 7.12.5) and for arithmetic expressions (section 7.6.1).
Portability
GNU Prolog predicates.