Code:
void UpdateQuestions()
{
SendMessage(lbQuestions, LB_RESETCONTENT, 0, 0);
strcpy(Path, RootDirectory);
strcat(Path, Course);
strcat(Path, "\\");
strcat(Path, Unit);
strcat(Path, "\\Questions.txt");
Questions = fopen(Path, "r");
while (fgets(FileLine, sizeof(FileLine), Questions) != NULL) /////////////////////////
{
char *p = strchr(FileLine, '\n');
if (p != NULL) *p = '\0';
SendMessage(lbQuestions, LB_ADDSTRING, 0, (LPARAM)FileLine);
}
fclose(Questions);
}
I get an error on the line with all the "/"s, specifics are:
----------------------------------------------------------------
| Debug Assertion Failed!
|
| Program: C:\Generator\Debug\Generator.exe
| File: fgets.c
| Line: 60
|
| Expression: str!= NULL
|---------------------------------------------------------------
But, I don't get it, cause this code has been working fine until now. I changed it around though, because I put it into a function, and made the "Path", "FileLine", and "Questions" variables global. Should I not do that? Any help appreciated
Thanks