cout<<"getting in issue read operation"<<endl;
ReadFile(hSerial, readbuff, dwBytesRead, &dwBytesRead, NULL);
cout<<"error: "<<GetLastError()<<endl;
if (!ReadFile(hSerial, readbuff, dwBytesRead, &dwBytesRead, NULL))
{
if (GetLastError() != ERROR_IO_PENDING)
cout << "Error in communications; report it.";
else
fWaitingOnRead = TRUE;
}
else
{
cout << "no waiting\n";
cout << "no. of bytes read: " <<dwBytesRead << endl;
cout<<"read buff: ";
for (DWORD i = 0; i < sizeof(writebuff); i++)
{
cout<< readbuff[i];`enter code here`
}
cout<<endl;
}
我不明白出了什么问题,因为每个 tym 我读了 0 个字节.....帮帮我 plzzz .....