Table of Contents
stream_get_integer_property
Gets the values of the specified integer properties of the stream.
Description
This function gets the values of the specified integer properties. Not all protocol drivers support
integer properties. If the protocol does not support integer properties then calling this function
will return -QERR_NOT_SUPPORTED
. If a particular integer property is not recognized
then it will return -QERR_PROPERTY_NOT_RECOGNIZED
.
The stream property functions allow more flexibility in controlling the behaviour of the underlying protocol.
Protocols may have custom integer properties. However, there are a set of standard integer properties which are listed below:
Property |
Access |
Description |
---|---|---|
STREAM_PROPERTY_BYTES_READ |
Read only |
The number of bytes read by the stream. |
STREAM_PROPERTY_BYTES_WRITTEN |
Read only |
The number of bytes written to the stream. |
Prototype
t_error stream_get_integer_property(t_stream stream, const t_stream_integer_property properties[], t_uint num_properties, t_int buffer[]);
Parameters
t_stream stream
A stream established using stream_listen, stream_connect or stream_accept.
const t_stream_integer_property * properties
An array of property codes containing the properties to be retrieved.
t_uint num_properties
The number of property codes in the properties array.
t_int * buffer
An array in which the property values will be returned. The value at a particular index corresponds to the property code at the same index in the properties array.
Return value
Returns 0 on success. If an error occurs then a negative error code is returned. If the protocol does not support integer
properties then -QERR_NOT_SUPPORTED
is returned. If a property code is not recognized then it will
return -QERR_PROPERTY_NOT_RECOGNIZED
.
Error codes
This function does not return any error code.
Requirements
Include Files |
Libraries |
---|---|
quanser_stream.h |
quanser_communications.lib;quanser_runtime.lib;quanser_common.lib |
Examples
t_stream client; const char uri[] = "file:myfile.txt?mode=r"; const t_int nonblocking = false; const t_int send_buffer_size = 8000; const t_int receive_buffer_size = 8000; result = stream_connect(uri, nonblocking, send_buffer_size, receive_buffer_size, &client); if (result == 0) { t_stream_integer_property codes = { STREAM_PROPERTY_BYTES_READ }; t_int values[ARRAY_LENGTH(codes)]; ... result = stream_get_integer_property(client, codes, ARRAY_LENGTH(codes), values); if (result >= 0) // then property value retrieved ... }
See Also
Copyright ©2024 Quanser Inc. This page was generated 2024-10-17. Submit feedback to Quanser about this page.
Link to this page.