INtime SDK Help
PurgeComm (Serial Communications)
INtime SDK v7.1 > About INtime > Networking and I/O > Serial Communications (COMM) > PurgeComm (Serial Communications)

Discards all characters of a specified communications resource from the output or input buffer. It can also terminate pending read or write operations on the resource.

BOOLEAN PurgeComm(
  COMMHANDLE hComm,  // handle to communications resource
  DWORD dwFlags      // action to perform


[in] Handle to the communications resource. OpenComm returns this handle.
[in] Specifies the action to take. This parameter can be one or more of the following values:
Value Description
PURGE_TXABORT Terminates all outstanding overlapped write operations and returns immediately, even if the write operations have not been completed.
PURGE_RXABORT Terminates all outstanding overlapped read operations and returns immediately, even if the read operations are not complete.
PURGE_TXCLEAR Clears the output buffer (if the device driver has one).
PURGE_RXCLEAR Clears the input buffer (if the device driver has one).

Return Values

0 (zero)
Failure. To determine the status, call GetLastRtError.


COMM channel is closed.
Invalid parameter.


If a thread uses PurgeComm to flush an output buffer, the deleted characters are not transmitted. To empty the output buffer while ensuring that the contents are transmitted, call FlushCommBuffers (a synchronous operation). Note, however, that FlushCommBuffers is subject to flow control but not to write time-outs, and it does not return until all pending write operations are transmitted.


Versions Defined in Include Link to
INtime 3.1 intime/rt/include/comm.h comm.h comm.lib
See Also