SP_fclose() #include <sicstus/sicstus.h>
spio_t_error_code
SP_fclose(
SP_stream *stream,
spio_t_bits close_options);
Close the stream.
SP_FCLOSE_OPTION_USER_STREAMS is
set, see below.
SP_FCLOSE_OPTION_READSP_FCLOSE_OPTION_WRITENote that it is possible to close only one direction of a
bidirectional stream. The return value will tell whether the stream is
still open; see below.
SP_FCLOSE_OPTION_FORCESP_FCLOSE_OPTION_NONBLOCKINGPass non-blocking option to lower level routines, including the call
to SP_flush_output() that is issued when non-forcibly closing write
direction.
One possible use for this option is to perform a best effort
close, which falls back to using SP_FCLOSE_OPTION_FORCE only if
ordinary close would block.
SP_FCLOSE_OPTION_USER_STREAMSuser_class of a user defined stream. When this option is
passed, all currently opened streams of that class is closed, using
the remaining option flags. E.g. to close all user defined streams
of class my_class in the read direction only do:
SP_fclose((SP_stream*)my_class,SP_FCLOSE_OPTION_USER_STREAMS|SP_FCLOSE_OPTION_READ).
On success, all specified directions has been closed. Since some direction may still be open, there are two possible return values on success:
SPIO_S_NOERRSPIO_S_DEALLOCATEDOn failure, returns a SPIO error code. Error codes with special meaning
for SP_fclose() are the same as for SP_flush_output(), which
see. Other error codes may also be returned.
cpg-ref-SP_flush_output. Prolog Streams.