Hi I have a struct that looks like this:
struct person {
int id;
char firstName[20];
char lastName[20];
int year;
int month;
int day;
int friends[100];
};
and a txt file that needs to be parsed:
Blake,Smith, 1963,12,2
Jake,Doe,1994,3,30
and I want it to parse with fscanf:
people[i].id = i + 1;
fscanf(fp, "%s,%s,%d,%d,%d\n", people[i].firstName, people[i].lastName, &people[i].year, &people[i].month, &people[i].day);
i++;
But it stores the whole line into firstname
even when i try to replace ',' with '%*c' it gets even worse and stores 2 lines in firstname