ferror()

Examines whether a file error has been noted.

Synopsis

int ferror(file f);

Parameters

Parameter Meaning
f File

Return value

Value is not equal to 0 if f contains errors.

The return value is not a specific error code, that is, it is not possible to derive the cause of an error.

Error

Description

Returns a value not equal to 0 if an error has been noted for f .

Example

main()
{
  file f; // our file
  int err; // error code
  f=fopen("C:/TEMP/TEST.TXT","r"); // open for reading
  err=ferror(f); // export error
  fclose(f); // close file
  if (err!=0) DebugN("Error no. ",err," occurred");
}

Assignment

File function

Availability

CTRL