Explain Formatted Input Output with File Pointer?
Likewise there are equivalents to the functions scanf and printf which write or read data to files. These are called fscanf and fprintf. The functions are used in the same way, except that the fscanf and fprintf take the file pointer as an additional first argument.
fscanf(file pointer, format specifier, &variable);
fprintf(file pointer, format specifier, variables);