INtime SDK Help
PurgeComm (Serial Communications)
INtime SDK v7 > 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
);

Parameters

hComm
[in] Handle to the communications resource. OpenComm returns this handle.
dwFlags
[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

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

Status

E_DISCONNECTED
COMM channel is closed.
E_PARAM
Invalid parameter.

Remarks

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.

Requirements

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