When reading data from a file that contains five integers per row (seperated by spaces) you want to keep only the first and last values in each row. Which of the following statements will correctly read the desired value into the variables x and y?
A. fscanf(fptr, "%*d %***d %d", &x, &y);
B. fscanf(fptr, "%d, %*d, %*d, %*d, %d", &x, &y);
C. fscanf(fptr, "%d, %3d, %d, &x, &y);
D. None of the above
I thought that it would be the opposite of B and what you would want stored would be %*d, but answer B is the only one that would make sense to me...unless the answer was none of the above??/ (yuck)
Thank you!!



LinkBack URL
About LinkBacks




A simple glance at the documentation for fscanf() will remove all doubt.