ferror
Display the error status of fileID.
Syntax
R = ferror(fileID)
Inputs
- fileID
- File ID returned from earlier call to fopen().
Outputs
- R
- An error message describing the problem encountered.
Example
% read file using 'w' causes error
fopen_fileID = fopen('testfile', 'w')
[fgets_text, fgets_len] = fgetl(fopen_fileID)
R = ferror(fopen_fileID)
fclose(fopen_fileID)
fopen_fileID = 4
fgets_text = -1
fgets_len = 0
R = Broken pipe
ans = 0