FERROR

The FERROR function returns a boolean value indicating whether then last operation that accessed a file concluded with an error or not. This can potentially be the case after any call to FOPEN, FWRITE, FGETI or FGETS.

Previous versions of XJTAG allowed FERROR to be called without any brackets. Support for this usage was removed in XJTAG v4.0.

Syntax

FERROR()
FERROR( FILE fileHandle )

Parameters

fileHandle

Optionally, the file handle to examine to see if the last access to it resulted in an error. If no file handle is specified, then the result is taken from the last file that was accessed in the current session.

Don't pass in a fileHandle argument when checking the result of FOPEN; if FOPEN has failed, then the file handle will not have been initialised and so cannot be accessed.

Return value

An INT value that indicates whether an error accessing a file occurred or not.

Example

LOCAL ReadFile()()
  FILE fileHandle;

  fileHandle := FOPEN("test.bin", "r");
  IF FERROR() THEN
    PRINT("Unable to open test.bin");
    EXIT;
  END;

  // Perform file operations on the file handle...

  FCLOSE(fileHandle);
END;