In the same way that printf has a companion function scanf for handling keyboard input, fprintf has a companion function fscanf for handling formatted file input based on the conversion of input fields. The fscanf function reads and translates fields according to a specific format and assigns them to the parameter list from left to right.
The function definition is as follows:
int fscanf (FILE * stream, const char * format [, argument list]);
The return value from fscanf is slightly different from fprintf, in that it contains the number of specific items read and converted, without counting any fields that have been ignored. Recall that fprintf returns the number of actual characters output to the file.
Also, if an error occurs, ...