• Advertisement
Sign in to follow this  

CreateFile Bug????

This topic is 4927 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm trying to debug a problem. I think it might be the CreateFile call in Visual C++. I have a loop while( app_run == true) { print("running..") if(something_to_ write == true) { CreateFile(...) WriteFile(...) CloseHandle() } } I check my directory for the file and it exists. However, nothing is written. I delete the file and it is re-created. At first, I thought it was my loop. However, I don't see my print statement be executed. It looks like it's stuck at the CreateFile call. Is there a bug in the CreateFile??? My settings are GENERIC_WRITE, FILE_SHARE_READ, CREATE_ALWAYS

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by fathom88
However, I don't see my print statement be executed. It looks like it's stuck at the CreateFile call.


How can it be stuck on CreateFile if it never even reaches the print statement? Also, use a debugger. This will tell you indeed where your program is stuck, assuming it is indeed stuck. Make sure you're flushing your output too... using the C++ iostream library (which you should be using, printf is the tool of the devil) that would be done as such:

cout << "Yadda yadda yadda" << flush;

(or implicitly via newline:)

cout << "Yadda yadda yadda" << endl;

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement