MATLAB Function Reference Previous page   Next Page
ferror

Query MATLAB about errors in file input or output

Syntax

Description

message = ferror(fid) returns the error string message. Argument fid is a file identifier associated with an open file (see fopen for a complete description of fid).

message = ferror(fid, 'clear') clears the error indicator for the specified file.

[message,errnum] = ferror(...) returns the error status number errnum of the most recent file I/O operation associated with the specified file.

If the most recent I/O operation performed on the specified file was successful, the value of message is empty and ferror returns an errnum value of 0.

A nonzero errnum indicates that an error occurred in the most recent file I/O operation. The value of message is a string that can contain information about the nature of the error. If the message is not helpful, consult the C run-time library manual for your host operating system for further details.

See Also

fclose, fopen, fprintf, fread, fscanf, fseek, ftell, fwrite


Previous page  feof feval Next page

© 1994-2005 The MathWorks, Inc.