Having opened a file, we use
fprintf(fp, ...);
where fp the file pointer returned by fopen(), and ``...'' is what you have already met for printf i.e. a format conversion string, followed by a list of arguments to be output. In fact there are two output files predefined for you, stdout and stderr. printf(...) is in fact fprintf(stdout,...) and is normally the screen but can be redirected by you using the > operator. stderr is always the screen.
maspjw@