The function writes the single character c to a file.
int fputc( int c, FILE * stream )
The function returns the character written. For fputc and _fputchar, a return value of EOF indicates an error. For fputwc and _fputwchar, a return value of WEOF indicates an error.
//The following example uses fputc and send a character array to fputc.out
char strptr1 = "This is a test of fputc!!\n";
FILE *stream = fopen( "fputc.out", "w+t" );
if(stream != NULL )
p = strptr1;
while( (*p != '\0') && fputc( *(p++), stream ) != EOF ) ;
The function writes the single character c to a file at the position indicated by the associated file position indicator (if defined) and advances the indicator as appropriate. In the case of fputc, the file is associated with stream. If the file cannot support positioning requests or was opened in append mode, the character is appended to the end of the stream.