I'm back again, with another fgets issue (sort of).
I've used this code numerous times, as it's quite standard, but for some reason I'm getting an error now.
And the parcel of code giving me the error (actually, I isolated it to just the while(fgets()!=NULL) loop - the code inside the loop has no influence).
Debug Assertion Failed
Expression: str != NULL
// Check for match before opening file
if(strcmp(STRTOCOMP1, STRTOCOMP2) == 0)
cFile = fopen(FILENAME, "r");
// If the file cannot be read, warn the user
MessageBox(Msg, "Error", MB_OK | MB_ICONEXCLAMATION);
// If the file can be read, proceed to read it in
while(fgets(Line, sizeof Line, cFile) != NULL)
// sscanf() stuff to a struct vector
// If there was no match, warn the user
MessageBox(Msg, "Error", MB_OK);
The code seems flawless -- why would it be throwing an assertion error? Unless I'm missing something completely obvious, which is kind of why I'm asking for help.