Siebel VB Language Reference > Methods Reference for Siebel VB > File Input and Output Methods >

End of File Method


The End of File method determines if the end of an open file has been reached. It returns one of the following values:

  • -1. The end of the file has been reached.
  • 0. The end of the file has not been reached.
Format

Eof(filenumber)

The following table describes the arguments that you can use with this method.

Argument
Description

filenumber

The file number you use in the Open statement to open the file. For information about assigning a number to a file when it is opened, see Open File Method.

Example

The following example uses the End of File method to read records from a random file. It keeps the Get statement from attempting to read beyond the end of the file. The CreateFile subroutine creates the C:\TEMP001 file that the main subroutine uses:

(general) (declarations)
Option Explicit
Declare Sub CreateFile

Sub CreateFile
   ' Put the numbers 1-10 into a file
   Dim x as Integer
   Open "C:\TEMP001" for Output as #1
   For x = 1 to 10
      Write #1, x
   Next x
   Close #1
End Sub

Sub Button_Click
   Dim acctno
   Dim msgtext as String
   newline = Chr(10)
   Call CreateFile
   Open "C:\temp001" For Input As #1
   msgtext = "The account numbers are:" & newline
   Do While Not Eof(1)
         Input #1,acctno
         msgtext = msgtext & newline & acctno & newline
   Loop
   Close #1
   Kill "C:\TEMP001"
End Sub

For another example, see Get Free File Number Method:

Siebel VB Language Reference Copyright © 2013, Oracle and/or its affiliates. All rights reserved. Legal Notices.