PrasM 0 Newbie Poster

Topic: ReadFile prob in Release mode
Posted: Today at 11:21pm
Hi,
I have written an application in MFC, to interface with a USB device to get Data. I have used a worker thread which pools for data.

I have used the CreateFile function with FILE_FLAG_OVERLAPPED Flag.

In ReadFile fn I pass the Overlapped structure with the Event handle.

During Debug Mode
I can Read the device Properly with all the data.
The sequence is
I get "ERROR_IO_PENDING" then using the HasOverlappedIoCompleted
I wait for the Flag to set.
The I use GetOverlappedResult to read the data.

In RELEASE MODE
if I use the "GO" (F5) I get all the data no probs. I also get the debug out strings using the OutputDebugString function.

BUUUUUUUUUTTTTTTT

When I RUN the application the ReadFile returns a error code value "2"
which is "The system cannot find the file specified"

I have checkd the Read handle's value its same in Debug and Release mode


Please help me resolve this issue.
thanks in advance
Prasanna