Information about file I/O errors
message
= ferror(fileID
)
[message
, errnum
]
= ferror(fileID
)
[...] = ferror(fileID
,
'clear')
returns
the error message for the most recent file I/O operation on the specified
file. message
= ferror(fileID
)message
is an empty character vector
when the most recent I/O operation is successful or when you clear
it manually. fileID
is an integer file
identifier obtained from fopen
,
or an identifier reserved for standard input (0
),
standard output (1
), or standard error (2
).
[
returns the
error number. If the most recent file I/O operation was successful, message
, errnum
]
= ferror(fileID
)errnum
is 0
.
A nonzero errnum
indicates that an error
occurred. Negative values correspond to MATLAB® error messages.
Positive values correspond to C library error messages for your system.
[...] = ferror(
clears the error indicator for the specified file.
Specify the literal fileID
,
'clear')clear
as a character vector
or a string scalar. When you clear the error indicator, succeeding
calls to ferror
behave as if the most recent I/O
operation was successful.