GEOS SDK TechDocs
|
|
1.5 Shutting Down a Stream
|
2 Using the Serial Ports
StreamFlush(), StreamQuery()
To flush all the pending (written but unread) data from a stream, call the routine
StreamFlush()
. This routine is passed two arguments:
GeodeHandle
of the stream driver.
StreamToken
of the stream.
To find out how much free space is available in a stream, or how much data is waiting to be read, call
StreamQuery()
. This routine is passed four arguments:
GeodeHandle
of the stream driver.
StreamToken
of the stream.
StreamRoles
enumerated type. The only appropriate values here are STREAM_ROLES_WRITER (to find the amount of free space available for writing) or STREAM_ROLES_READER (to find the amount of data waiting to be read).
If the call is successful,
StreamQuery()
returns zero and writes its return value to the fourth argument. If you pass STREAM_ROLES_WRITER,
StreamQuery()
writes the number of bytes of free space available in the stream buffer. If you pass STREAM_ROLES_READER,
StreamQuery()
returns the number of bytes of data waiting to be read. If the call is unsuccessful,
StreamQuery()
returns a
StreamError
.
GEOS SDK TechDocs
|
|
1.5 Shutting Down a Stream
|
2 Using the Serial Ports