Converts between Prolog representation, Stream, and C representation, CStream, of a stream.
stream_code/2 is used when there are input/output related operations
performed on the same stream in both Prolog code and foreign code.
Stream argument is a valid type if it is user, user_input,
user_output, user_error, a variable, or a value obtained through
open/[3,4] or previous
Such a valid Stream value can be used as the stream argument to
any of the Prolog built-in I/O predicates taking a stream argument.
CStream argument is a valid type if it is a variable, a value obtained
stream_code/2 call, a value obtained through
QP_fdopen(), or a value of pointer to
QP_stream structure obtained through foreign function call.
Such a valid CStream value can be used as the stream argument to
any of the QP foreign function taking stream as an argument.
The most frequent use of
to get a stream value to be used in Prolog code for a stream created
in foreign code. This is necessary when a desired stream can not be
open/[3,4]; e.g. a stream referring to a socket
or an encrypted file.