fgetc(), getc(), getchar() - get next character or word from input stream
#include <stdio.h>
int fgetc (FILE *stream)
int getc (FILE *stream)
int getchar(void)
The fgetc(3) function obtains the next input character (if present) from the stream pointed at by stream, or the next character pushed back on the stream through ungetc(1).
The getc(3) function acts essentially identically to fgetc(3), but is a macro that expands in-line.
The getchar(3) function is equivalent to:
getc(stdin)
Once end-of-file is reached, the end-of-file condition is remembered, even on a terminal, and all subsequent attempts to read will return EOF until the condition is cleared with clearerr(3).
If successful, these routines return the next requested object from the stream. If the stream is at end-of-file or a read error occurs, the routines return EOF. Since EOF is a valid integer value, you must use feof(3) and ferror(3) to distinguish between end-of-file and error. If an error occurs, the global variable errno is set to indicate the error.
These functions can set errno to the following values:
ferror(3)
fread(3)
fopen(3)
putc(3)
ungetc(3)