Hello, I have this file with input data it looks like this:
Code:
Ann I.
103
Ann X.
11
Jim C.
106
Ann B.
123
John LongLastName
143
class size 3
drop
11
103
106
I'm having trouble figuring out how I can scan this in.... I have defined a structure data type like this
Code:
typedef struct student {
char name[11];
int ID;
struct student* studentPtr;
} STUDENT;
What I want to do is create a stack using linked lists with the student name in the .name member and the number under the student name in the .ID member
but I have extra information in my input file that I do not need to scan in yet, and I don't want it in my linked lists.... I'm having trouble figuring out how to make a loop that will stop after the last student.....
in this case:
Code:
John LongLastName
143
I've declared these pointers to files
Code:
FILE *fin, *fout;
fin = fopen("cp5.in", "r");
fout = fopen("cp5_test.txt", "w");
i've been trying different fscanf parameters and while loops... but they all go pass the student names and IDs data
any suggestions?
Thank You