I need to read in separate numbers from a file and then use them in code.
For example the file will say things like
2 5
8 9
22 4
1 12
And right now I have:
while(fgets(line, MAX_LEN, in) != NULL)
{
ListRef test = newList();
token = strtok(line, " \n");
int x = token[0] - '0';
int y = token[2] - '0';
}
Which works fine, except not if one or both of the numbers is multiple digits. How would I change this to read in both numbers (there will always be two, and that's it) on a line, regardless of their length?