stream_peek_unit_array End of trail navigation bar

stream_peek_end

Finishes a "peek" operation by removing all peeked data from the input stream.

Description

This function finishes a "peek" operation by removing all peeked data from the input stream. It must be called after a sequence of stream_peek_xxxx operations to complete the peek. If the status argument is one then it advances the input stream and the data is removed from the input stream to make room for new data. If the status argument is less than one then the input stream is not advanced. In that case, the data will remain in the input stream and will be read the next time the user receives data from the stream.

The status argument is generally the result of the last stream_peek_xxxx operation. Refer to the stream_peek_begin function for an example.

This function assumes that the stream is valid. It does not block because it does not access the underlying communication channel.

Prototype

t_error
stream_peek_end(t_stream stream, t_stream_peek_state * state, t_error status);
    

Parameters

t_stream stream

A client stream established using stream_connect or stream_accept.

t_stream_peek_state * state

The "peek state" indicating how much data to remove from the input stream.

t_error status

This value is typically the result from the last stream_peek_xxxx operation. If it is 1 then the peek is completed and the stream pointer advanced. If it is 0 beceause the stream closed before finishing the peek operations then this function does not advance the stream pointer and returns 0. If it is negative then the stream pointer is not advanced and the status is returned as the result.

Return value

This function returns an error if one of the parameters is invalid or the stream is shutdown or closed, or the status argument is negative. It returns one if the status argument is one and the peek is completed successfully. It returns zero if the status argument is zero.

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

See Also

 

navigation bar