用ReadFile读串口时出现ERROR_IO_PENDING错误,不知如何解决.
我看了MSDN.处理是:
case ERROR_IO_PENDING:
{
// asynchronous i/o is still in progress
// do something else for a while
GoDoSomethingElse() ;
// check on the results of the asynchronous read
bResult = GetOverlappedResult(hFile, &gOverlapped,
&nBytesRead, FALSE) ;
// if there was a problem ...
if (!bResult)
{
// deal with the error code
switch (dwError = GetLastError())
{
case ERROR_HANDLE_EOF:
{
// we're reached the end of the file
//during asynchronous operation
}
// deal with other error cases
}
}
} // end case
好像是等待的时间很短就去读串口了,但我已经等待了2妙还是不行.要怎么样处理这个问题呢?