message = ferror(fid)message = ferror(fid,'clear')[message, errnum] = ferror(...)
message = ferror(fid) returns the error message message. 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, ferror returns an errnum value of 0 and the value of message is empty.
A nonzero errnum indicates an error occurred in the most recent file I/O operation. Two ways that you can learn more about the nature of the error are
message is a string that may contain information about the nature of the error.stdio.fclose,fopen,fprintf,fread,fscanf,fseek,ftell,fwrite,sprintf,sscanf
(c) Copyright 1994 by The MathWorks, Inc.