Next: , Previous: , Up: cpg-bif   [Contents][Index]


12.3.19 SP_flush_output()

Synopsis

#include <sicstus/sicstus.h>

spio_t_error_code
SP_flush_output(
  SP_stream *stream,
  spio_t_bits flush_options);

Ensure that all buffered data reaches its destination.

Arguments

stream

The stream to flush. This stream should be open for writing.

flush_options

The following bits can be set:

SP_FLUSH_OUTPUT_OPTION_NO_FSYNC

If this is set, flush will not wait for data to reach the disk. See the SP_fclose() option SP_FCLOSE_OPTION_NO_FSYNC for more information.

SP_FLUSH_OUTPUT_OPTION_NONBLOCKING

If this is set, the function should return quickly or with a SPIO_E_WOULD_BLOCK code.

Can return SPIO_E_NOT_SUPPORTED if the stream cannot support non-blocking flush.

SP_FLUSH_OUTPUT_OPTION_AUTOFLUSH

Only flush stream if it has AUTOFLUSH enabled.

Return Value

On success, all buffered data should have been written and SPIO_S_NOERR or some other success code returned.

On failure, returns a SPIO error code. Error codes with special meaning for SP_flush_output():

SPIO_E_END_OF_FILE

Returned if it is not possible to write more data onto the stream, e.g. some underlying device has been closed.

SPIO_E_WOULD_BLOCK

SP_FLUSH_OUTPUT_OPTION_NONBLOCKING was set but the operation would block.

SPIO_E_NOT_SUPPORTED

Some unsupported option, e.g. SP_FLUSH_OUTPUT_OPTION_NONBLOCKING, was passed.

Other error codes may also be returned.

See Also

Prolog Streams.


Send feedback on this subject.