C Language: getc function(Read Character from File)

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

Syntax

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




int getc(FILE *stream);



Parameters or Arguments

stream

The stream to read.

Returns

The getc function returns the character read. If an error occurs, the getc function will set the stream's error indicator and return EOF. If the getc 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 getc function is:




#include <stdio.h>



Applies To

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

  • ANSI/ISO 9899-1990

stdio.h Functions





Instagram