EOF Function

EOF(Filenumber)

 

Returns a value during file input that indicates whether the end of a file has been reached. 

 

              Related Topics:  Open Statement

 

             

                  Example:

' Input Function Example

 

' This example uses the Input function to read 10 characters at a time from a ' file and display them in a MsgBox.  This example assumes that TESTFILE is a 'text file with a few lines of 'sample data.

 

Sub Main

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

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

   MyStr = Input(10, #1)   ' Get ten characters.

   MsgBox MyStr

    Loop

    Close #1        ' Close file.

End Sub