检测空缓冲区在Windows程序无需使用ReadFile的()
题
我()以上的同步把手使用而不是使用的ReadFile()不知道是否有沿IsBufferEmpty的线的任何功能和等待它返回false。我需要的东西,以消除ReadFile的()将尝试读取数据的延迟。
解决方案
这是对串行端口的通信?
如果是这样,可以使用 ClearCommError()
一>功能:
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 */
不隶属于 StackOverflow