September 9th, 2010, 12:20 PM
Re: CreateFile Failed problem
What do you mean "not return anything?"
Originally Posted by wklove2003
That is all we have been waiting for all this time. What is the error value?
if (mFd == INVALID_HANDLE_VALUE)
DWORD dwError = GetLastError();
printf("The value of the error code is %d\n", dwError);
That is what your original code was missing -- you never checked at all for the reason code for the failure. All you did was check for failure, and all we asked you to do is go further and check the reason for the failure by calling GetLastError(). That doesn't sound complex to me.
if ( ThisFunctionCallReturnedFailure )
DWORD dwError = GetLastError( );
// dwError now has the reason code for why the function failed
What we asked you to do has nothing to do with the size or complexity of the program.
I am a complete newb to programming, but unfortunately, have been handed a project that is dealing with a fairly complex program that was downloaded. So most of the code I have posted, I did not actually do. Just trying to get this program to run properly ASAP
All we wanted was you to make a single function call, GetLastError() and see what value is returned, instead of being in the dark as to why CreateFile fails. If you can't do that, then may I suggest you get someone else to finish your program, since what we asked is the simplest of things.
Last edited by Paul McKenzie; September 9th, 2010 at 12:26 PM.
Tags for this Thread
Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.