views:

197

answers:

1

I was wondering if there was any function along the lines of IsBufferEmpty() to use on a synchronous handle rather than using ReadFile() and waiting for it to return false. I need something to eliminate the delay that ReadFile() takes to try to read data.

A: 

Is this for serial port communication?

If so, you can use the ClearCommError() function:

DWORD com_errors = 0;
COMSTAT com_stat;

ClearCommError(serial_port_handle, &com_errors, &com_stat);
/* com_stat.cbInQue now holds the number of characters in the receive buffer */
Steef
It is for serial port communication.Thanks for the information, I never would've guessed that you could access it by a clear error function.