Hi, im trying to write a bunch of strings into a text file which are received through the com port.
every so often though the program gives a fatal error and i get a dialog box which go's something like
fatal error....
...
str != NULL
it points to line 56 of fprintf.c and says that an "assertion failure" was caused.
i think it might be because its trying to write a string when it hasnt received anything.
im using the code below to write my strings into the file
Code:
fprintf(fp,"%s", decoded);
i have modified it so it doesnt continue when it cant write the string so my new code looks like
Code:
if((fprintf(fp, "\n") || fprintf( fp,"%s", decoded)) == EOF)
{
printf("No string/String error");
}
else{
fprintf(fp,"%s", decoded);
}
howver, its still giving me the same error after a few hours
Could someone tell me what the error is and what i might be doing wrong?
thanks
VC++ , windows XP