C Language: fgetc function(Read Character from File)

In the C Programming Language, the fgetc function reads a character from the stream pointed to by stream.


The syntax for the fgetc function in the C Language is:

int fgetc(FILE *stream);

Parameters or Arguments


The stream to read.


The fgetc function returns the character read. If an error occurs, the fgetc function will set the stream's error indicator and return EOF. If the fgetc function encounters the end of stream, it will set the stream's end-of-file indicator and return EOF.

Required Header

In the C Language, the required header for the fgetc function is:

#include <stdio.h>

Applies To

In the C Language, the fgetc function can be used in the following versions:

  • ANSI/ISO 9899-1990

stdio.h Functions