Each input and output stream is represented by a unique Prolog term, a stream object. In general, this term is of the form
'$stream'(X)alias(Atom) option of
open/4. There are also three predefined aliases:
          user_inputstdin
stream.  The alias can be changed with prolog_flag/3
and accessed by the C variable SP_stdin.
          user_outputstdout
stream.  The alias can be changed with prolog_flag/3
and accessed by the C variable SP_stdout.
          user_errorstderr
stream.  The alias can be changed with prolog_flag/3
and accessed by the C variable SP_stderr. 
This stream is used by the Prolog top-level and debugger, and
for all unsolicited messages by built-in predicates. 
Stream objects are created by the predicate open/[3,4]
ref-iou-sfh-opn and passed as arguments to
those predicates that need them. 
Representation for stream objects to be used in C code is different. 
Use stream_code/2 to convert from one to the other when
appropriate.