Reputation: 235
How to know the data bytes availability at serail port in windows? I mean, I just want to check whether serail port empty or not?
NOTE: there was function in Linux "ioctl(fd,FIONREAD,&availableBytes)", I need to implement similar functionality in windows.
~ Johnnie
Upvotes: 1
Views: 2350
Reputation: 33
This solved my problem:
Call the ClearCommError function and check the return in lpStat->cbInQue.
& I think it should solve yours too.
Refer windows api documentation for more clarification on ClearCommError() function.
https://msdn.microsoft.com/en-us/library/windows/desktop/aa363180%28v=vs.85%29.aspx
Upvotes: 2
Reputation: 670
ClearCommError is used to obtain error and stats info.
http://msdn.microsoft.com/en-us/library/aa363180%28v=vs.85%29.aspx
Upvotes: 0