To read a single character from a file that has been opened with a call to fopen and from which reading may occur, use the fgetc function, whose definition is as follows:
int fgetc ( FILE * stream )
This function will read the next character from the input stream, should one exist. If there is no character available, it will return an error value. Because 0 is an appropriate value for a character (if maybe a little unusual), the return value is likely to be -1. However, this might change, depending on the compiler, so you’re advised to check beforehand.
The companion function to fgetc is fputc, which has the following definition:
int fputc ( char character, FILE * stream )
Not surprisingly, this function will write ...