The first of the formatted I/O functions covered here is parallel to the printf function you learned about in Chapter 5. It is called fprintf and allows you to output text to a file that has been opened for writing (or reading and writing).
The fprintf function allows you to output data to the file exactly as if it were outputting to the screen. The definition of fprintf is as follows:
int fprintf (FILE * stream, const char * format [, argument list]);
The [argument list] will depend on the contents of the format parameter; it may be that there are zero parameters or many, depending on how many translatable data fields exist in format. In this respect, the function is identical to the standard printf. The file handle is provided ...