C Language: ferror function(Test for File Error)

In the C Programming Language, the ferror function tests to see if the error indicator has been set for a stream pointed to by stream.

Syntax

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




int ferror(FILE *stream);



Parameters or Arguments

stream

The stream whose error indicator is to be tested.

Returns

The ferror function 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 function is:




#include <stdio.h>



Applies To

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

  • ANSI/ISO 9899-1990

stdio.h Functions





Instagram