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().
Type: double | integer

Outputs

R
Logical result of the test. true/1 when the end of file has been reached, false/0 otherwise.
Type: logical

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