ClearCommError错误问题,求指点,急,谢谢!!!
用ClearCommError来确定缓冲区数据大小,确只能接受8个字节。缓冲区大小我已经设置成4096了。
部分代码
int __stdcall InQueCount(HANDLE ComHandle){ if (ComHandle<0){return Bad_CommOpen;} COMSTAT CT; DWORD Error; ClearCommError(ComHandle,&Error, &CT); return (CT.cbInQue);}
SendData(ComHandle,SEND_BUF,2); SETTIMEOUT(TIME_NAK); do { if (InQueCount(ComHandle) > 0) break; }while(!TIMEOUT); if (TIMEOUT) return ERR; dlength=InQueCount(ComHandle); ReceiveData(ComHandle,ReceiveBuf,dlength);