|• ref-iou-str-not:||Programming Note|
|• ref-iou-str-sca:||Stream Categories|
A Prolog stream can refer to a file or to the user’s terminal3. Each stream is used either for input or for output, but typically not for both. A stream is either text, for character and term I/O, or binary, for byte I/O. At any one time there is a current input stream and a current output stream.
Input and output predicates fall into two categories:
Initially, the current input and output streams both refer to the user’s terminal. Each input and output built-in predicate refers implicitly or explicitly to a stream. The predicates that perform byte, character and term I/O operations come in pairs such that (A) refers to the current stream, and (B) specifies a stream.
predicate_name/n (A) predicate_name/n+1 (B)
At the C level, you can define more general streams, e.g. referring to pipes or to encrypted files.