Look RS232 > RS232C Hardware  
fCoder SIA
fCoder SIA Look RS232 Download Order Support Cookie Policy
Look RS232
Download
Order
Support
Testimonials
FAQ
Online help
Modem Programming
Serial port
RS232 Hardware
Programming
  PurgeComm

Before starting your work with the port it is desirable to clear the buffers; sometimes there's also need to clear the buffers when working with ports. For these purposes PurgeComm function can be used. This function can also stop read and write operations.

Function syntax:

BOOL PurgeComm(HANDLE hFile, DWORD dwFlags);

Parameters specifications:

hFile - descriptor of the open communication port file;

dwFlags - task to be performed.

This function can perform two tasks: clear the I/O queue in the driver or finish all the I/O operations. The tasks to be performed are specified by the following parameters:

  • PURGE_TXABORT � immediately stops all write operations even if they are not finished;
  • PURGE_RXABORT � immediately stops all read operations even if they are not finished;
  • PURGE_TXCLEAR � clears the out -queue in the driver;
  • PURGE_RXCLEAR � clears the in -queue in the driver.

Note

These values can be combined with the help of bitwise OR operation. It is recommended to clear the buffers when I/O errors occur and after the work with the port is finished.
 
  Contact us
© fCoder SIA