Streams A file is referred to by its name, written as an atom, eg. Unless directed otherwise , input or output refer to standard input and standard output.
Streams are a special type of term.
Each stream is either for input or output, not both. At end of file, the built-in predicate eof becomes true. When the current output stream is closed, standard output becomes the current output stream. Similarly, when the current input stream is closed, standard input becomes the new input stream. However, output to a stream does not necessarily get sent immediately due to it being buffered.