C Language: feof function(Test for End-of-File)

In the C Programming Language, the feof function tests to see if the end-of-file indicator has been set for a stream pointed to by stream.


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

int feof(FILE *stream);

Parameters or Arguments


The stream whose end-of-file indicator is to be tested.


The feof function returns a nonzero value if the end-of-file indicator is set. Otherwise, it returns zero.

Required Header

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

#include <stdio.h>

Applies To

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

  • ANSI/ISO 9899-1990

stdio.h Functions