feof
Returns 1 if an end-of-file symbol is encountered.
Syntax
feof(fileID)
Inputs
- fileID
- File ID returned by an earlier call to fopen().
Outputs
- R
- Logical result of the test. true/1 when the end of file has been reached, false/0 otherwise.
Example
Simple input:
fileID = fopen('testfile7', 'r')
while feof(fileID) == false
[fgets_return, fgets_length] = fgets(fileID)
ftell_return = ftell(fileID)
end
fclose(fileID)
fileID = 6 % fopen result
fgets_return = testoutput001
fgets_length = 15 % length of input data
ftell_return = 15 % position in file after read
ans = 0 %result of fclose