Hi, I have a text file of associated numbers i.e;
1 2 2
3 2 1
3 4 3
Each line is a seperate piece of information, as such I am trying to read it in one line at a time and then seperate it into the 3 numbers but sscanf isn't doing what I expect it to.
char s[5];
char e[5];
char line[100];
int d;
fgets(line, sizeof(line), inFile);
sscanf(line, "%s %s %d", s, e, d);
putting in a printf after fgets yeilds:
1 2 2
but then after sscanf, the variables 's' and 'e' are null while 'd' is some random number that I can't even figure out where it's come from.
Not sure what I'm doing wrong, any help would be greatly appreciated.