Home > Language Reference > File Functions > Eof

Eof

The Eof function determines if the end of the specified file has been reached.

Usage

Used in loop constructions to detect the end of the file which is processed.

Syntax

var=Eof(<filename>)

Parameters

<filename>, string, name of the file.

Return value

var, integer. If the end of the file has been reached, the return value is 1, otherwise 0. If <filename> is not open for reading or does not exist, the return value is 0. 

See also

Read
GetReadPos 
SetReadPos

Examples

var=Eof("c:\wttest\test.txt")
msgbox(var)

'If the file does not exist
'Ignore Errors
#IgnoreErrors=1
var=Eof("c:\bla\test.txt")
msgbox(var)