11-02-2009 04:26 PM
Darnell:
Based on your prototype, Write_HrChecks_To_Script_File() is looking for a pointer to a string, not a long or HRESULT.
int Write_HrChecks_To_Script_File (char stringToWrite[]);
When you cast hresult as (char*), you are casting it as a pointer to char. You are not converting it to a string.
You created a pointer to char with (char*) hresult, but you haven't initialized the char or string that it points to.
Since (char*) hresult is just a pointer, that is your uninitialized string that generates the error.
Since you didn't post the declaration for g_comError, it looks like you're doing the same thing with it: creating a pointer that doesn't point to anything since you haven't initialized it.
HRCHECK_FILE((char*)g_comError.sCode);
What you are doing is similar to doing the following.
char *myString; // myString is a pointer to char
printf("%s", myString); // error: you can't use myString yet because you haven't initialized it.
What do you want the string you pass to Write_HrChecks_To_Script_File() to contain? If you want it to contain the number, you could do something like the following in the calling routine.
char sMsg[256];
.....
sprintf(sMsg, "%d", g_comError.sCode);
HRCHECK_FILE(sMsg);
11-02-2009 06:14 PM
yea I saw that at the last minute, I had to hit myself in the head for that one. Al S i have a question, pertaining to pointers. when , and why do people double*** or
double **
also do you have good site on pointers , i need to refreshing my memory a little bit.
11-02-2009 06:16 PM