Here is my function that read a name and a score that is send to a struct but my programm stop at the moment I go there. Why ?
Here is my code
void read_scores(char* filename, struct Player* P) {
printf("Opening file: %s\n", filename);
FILE * file = fopen(filename, "r");
if (file == NULL) {
printf("Could not open file %s\n", filename);
P->score = 0;
return;
}
char name[MAX_NAME_LENGTH];
int score;
while (fscanf(file, "%s %d", name, &score) != EOF) {
if (strcmp(name, P->name) == 0) {
P->score = score;
break;
}
}
fclose(file);
}