#include <stdio.h>int fputc(int ch, FILE *stream);
The fputc( ) function writes the character ch to the specified stream at the current file position and then advances the file position indicator. Even though ch is declared to be an int for historical reasons, it is converted by fputc( ) into an unsigned char. Because a character argument is elevated to an integer at the time of the call, you will generally see character values used as arguments. If an integer were used, the high-order byte(s) would simply be discarded.
The value returned by fputc( ) is the value of the character written. If an error occurs, EOF is returned. For files opened for binary operations, an EOF may be a valid character, and the function ferror( ) will need to be used to determine whether an error has actually occurred.
Related functions are fgetc( ), fopen( ), fprintf( ), fread( ), and fwrite( ).