Availability:C-language interface function
int PL_get_stream(term_t
t, IOSTREAM **s, int flags)Get a stream handle from the Prolog term t. Returns TRUE
on success and FALSE
on failure, by default generating an
exception. The flags argument is a bitwise disjunction of
these flags:
SIO_INPUT
- Get an input stream. If t is a stream pair (see stream_pair/3),
return the input channel. If t is an output stream the
function fails.
SIO_OUTPUT
- Get an output stream. See
SIO_INPUT
for details.
If neither SIO_OUTPUT
nor SIO_INPUT
is given t
may not be a pair.
SIO_TRYLOCK
- Return
FALSE
if the stream cannot be locked immediately. No
error is generated.
SIO_NOERROR
- If the function fails no exception is produced.
The returned stream is owned by the calling thread using
PL_acquire_stream().