spio_t_error_code user_write( void *user_data, void const *buf, size_t *pbuf_size, spio_t_bits write_options );
This is the prototype for one of the methods of user defined streams. It is used when SICStus wants to write data to the user defined stream.
*pbuf_sizeshould be set to the number of bytes actually written, which should always be positive for successful return.
Note that buffer size is measured in bytes also for text streams.
spio_t_wchar. Note that
*buf_sizeis size in bytes, not in characters.
user_write will never block, you can ignore this value.
You should return
cannot support non-blocking write.
*pbuf_size should be assigned to with the number of
bytes written and
SPIO_S_NOERR or some other success code
returned. On success, something must have been written, e.g.
*pbuf_size must be set to a positive value.
On failure, return a SPIO error code. Error codes with special meaning
SPIO_DEVICE_WRITE_OPTION_NONBLOCKINGwas set but the operation would block.
SPIO_DEVICE_WRITE_OPTION_NONBLOCKING, was passed.
Other error codes may also be returned.
Should write up to
*buf_size bytes of data from
buf. Data could be either bytes, for a binary device, or wide
characters, for a text device.
cpg-ref-SP_create_stream. Defining a New Stream.