If the contents of a file do not match the format string passed to fscanf, what happens on the next call to fscanf?
Suppose a file contains the following two lines:
9000 pig dog
4 5 2
A program tries to parse the opened file (fp) as such:
int a = 1, b = 1, c = 1;
int x = 1, y = 1, z = 1;
fscanf(fp, "%d %d %d", &a, &b, &c);
fscanf(fp, "%d %d %d", &x, &y, &z);
I suspect that a would now hold 9000 while b and c continue to hold the value 1 -- but what happens to x, y, and z?
Does the C99 standard guarantee that x, y, and z will hold the values 4, 5, and 2 respectively -- or is the file stream's position indicator guaranteed to be left unmodified after a failed parse, causing x to hold the value 9000 while y and z hold on to the value 1?