CitectVBA Programming Reference > CitectVBA Function Reference > File I/O Functions > EOF


EOF function returns a Boolean True or False value during file access that indicates whether the current position of an open file has reached the end of the file. The required FileNum argument must contain an Integer representing any valid system file number associated with an open file.

Note: The file system keeps track of all open files and the current position of access within every file. Every statement or function that accesses the data within a file, alters the current position within that file. The Loc function can be used to determine the current position within an open file.

Use the LOF and Loc functions instead of EOF when reading binary files with the Input function, or use Get when using the EOF function.

Note: An error occurs with files opened for Binary access, when the file is read using the Input function until EOF returns True.




An Integer or numeric expression representing any valid number in the range 1 to 511 inclusive, which is referenced by the file system to be associated with an open file.

Return Value

Returns an Integer containing the Boolean value False until the end of the file has been reached. Returns True when the end of a file opened for Random or sequential Input has been reached.

Related Functions

FileLen | Loc | LOF | Seek


Dim strFileContents as String, strTemp as String
Open "c:\test.txt" For Input As #1 ' open file
Do While Not EOF(1) ' loop until end of file
strTemp = Input(10, #1) ' read next ten characters
strFileContents = strFileContents & strTemp ' join strings
Close #1