ferror function(Test for File Error) in C Language – example and detail

In the C Programming Language, the ferror characteristic checks to see if the error indicator has been set for a movement pointed to by way of stream.


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

int ferror(FILE *stream);

Parameters or Arguments

stream The circulate whose error indicator is to be tested.


The ferror characteristic returns a nonzero value if the error indicator is set. Otherwise, it returns zero.

Required Header

In the C Language, the required header for the ferror characteristic is:

#include <stdio.h>

Applies To

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

ANSI/ISO 9899-1990

Similar Functions

Other C functions that are similar to the ferror function:

feof function <stdio.h>

See Also

Other C functions that are noteworthy when dealing with the ferror function:

clearerr characteristic rewind characteristic