fputc() - I/O Function
How is "fputc()" used in C++?
How to write character to stream?
is an I/O function that is used to write the character "ch" to the specified stream at the current file position indicator, then increases file position indicator. If no error occurs the same character that has been written is returned otherwise EOF is returned with the error indicator being set.
int fputc(int ch, FILE *stream);
FILE *str=fopen("fputceg.txt", "w+");
fputc ( 'A', str);
str = fopen("fputceg.txt", "r");
fscanf(str, "%s", name);
In the above example the "fputc()" is used to write a character "A" into a text file. Using the
"fscanf()" its read and displayed.