spio_t_error_code user_read( void *user_data, void *buf, size_t *pbuf_size, spio_t_bits read_options );
This is the prototype for one of the methods of user defined streams. It is used when SICStus need to obtain more data from the user defined stream.
*pbuf_sizeshould be set to the number of bytes stored in the buffer, 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_read will never block, you can ignore this value.
You should return
cannot support non-blocking read.
*pbuf_size should be assigned and
SPIO_S_NOERR or some other success code returned.
On failure, return a SPIO error code. Error codes with special meaning
SPIO_DEVICE_READ_OPTION_NONBLOCKINGwas set but the operation would block.
SPIO_DEVICE_READ_OPTION_NONBLOCKING, was passed.
Other error codes may also be returned.
buf with up to
*buf_size bytes of data. Data
should be either bytes, for a binary device, or
(32 bit) wide characters, for a text device.
cpg-ref-SP_create_stream. Defining a New Stream.