Reputation:
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.
Upvotes: 0
Views: 530
Reputation: 34685
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 */
Upvotes: 1