fgetc

Full prototype:

int fgetc(FILE*);  

Purpose and Notes:

A function that returns the next character (as an int so it can also return EOF) from the file stream pointed to by the FILE* passed in as the only argument. The function returns EOF under three circumstances: if the EOF indicator is set for the file. If the next character in the stream is the end of the stream and thus sets off the EOF indicator itself. Or if there is an error reading from the stream.

Returns:

int- The next character in the file stream passed in by the FILE* argument. Stored as an int as it will return the EOF (which is beyond the ASCII codes and thus requires an int to store) if the end of the file is reached, EOF is set for the stream, or an error occured reading from the stream.

Argument 1:

FILE*- A pointer to a file stream to read in one character.

Example 1