PurgeComm

  BOOL PurgeComm(hComDev, fdwAction)    
  HANDLE hComDev; /* identifies comm device to purge */
  DWORD fdwAction; /* specifies queues to purge */

The PurgeComm function removes all characters from the transmit or receive queue of the specified communication device.

Parameters

hComDev

Specifies the communication device to purge. This handle is returned by the CreateFile function.

fdwAction

Specifies the action to take when purging the communication device. This parameter can be some combination of the following values:

Value Meaning

PURGE_TXABORT  
  All outstanding write operations are terminated and return immediately, even if the write operations have not yet completed.
PURGE_RXABORT  
  All outstanding read operations are terminated and return immediately, even if the read operations have not yet completed.
PURGE_TXCLEAR  
  The transmit queue is cleared (if the device driver has one).
PURGE_RXCLEAR  
  The receive queue is cleared (if the device driver has one).

Return Value

The return value is TRUE if the function was successful, or FALSE if an error occurred. Use the GetLastError function to obtain extended error information.

Comments

The PurgeComm function deletes the queue contents or aborts outstanding operations.

See Also

CreateFile