int fputc (int character, FILE * stream);
Write character to stream.
Writes character to the current position in the specified stream and increases the file position pointer to the next character.
If there are no errors the written character is returned. If an error occurs, EOF is returned.
Note that when you work with binary files EOF is a valid character and you should use ferror() function to check if an error has occurred.
Defined in ANSI-C.
/* fputc example: alphabet writer */
FILE * pFile;
pFile = fopen ("alphabet.txt","w");
for (c = 'A' ; c <= 'Z' ; c++)
fputc (c , pFile);
This program creates a file called alphabet.txt and writes
ABCDEFGHIJKLMNOPQRSTUVWXYZ on it.
fgetc, fread, fwrite, fopen, putc