Hello folks,
what i'm trying to do is to read data separated by whitespaces (' ', '\t') from file using fscanf
and put it into struct array
here's a piece of code:
it doesn't print it as it should.Code:typedef struct { char id[4], name[20]; int grade; }rec; ... rec recs [10] ... while(fscanf(f, "%[^ ]%[^ ]%d", recs[i].id, recs[i].name, &recs[i],grade)) { printf("%s %s %d", recs[i].id, recs[i].name, recs[i].grade); i++; }
i know that the problem is in reading (in second arg of fscanf)...
any ideas?



LinkBack URL
About LinkBacks




