سؤال

One can use the GetOverlappedResult() function to get the number of read bytes from a successfull overlapped (asynchronous) ReadFile() operation.

I can't find a way to get the number of read bytes while the operation is still pending or after it has been aborted. The GetOverlappedResult() function seems to set the number of read bytes to 0 in both case. Any idea how to do that?

Edit: This asynchronous I/O operation is performed to retrieve data coming from an embedded device through a COM port. The operation is aborted after a timeout. I need the number of received bytes before operation was aborted only for debugging purpose.

هل كانت مفيدة؟

المحلول

The ClearComError function can fill a structure giving the number of bytes received and not yet consumed by a ReadFile operation.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top