EOF (function)

<< Click to Display Table of Contents >>

EOF (function)

EOF(FileNumber)

Returns True if the end of the file has been reached.

FileNumber is the number assigned to the respective file by the Open statement.

See also: Open

Example:

' Read 10 characters at a time from a file and display them.

' "Testfile" must already exist.

Sub Main

 Open "TESTFILE" For Input As #1   ' Open file

 Do While Not EOF(1)               ' Repeat until end of file

         MyStr = Input(10, #1)          ' Read 10 characters

         MsgBox MyStr

 Loop

 Close #1                          ' Close file

End Sub