Siebel VB Language Reference > Methods Reference for Siebel VB > File Control Methods >

Get Free File Number Method


The Get Free File Number method returns the lowest unused file number. It does not include arguments. You can use it if you must supply a file number and must make sure that this file number is not already in use. You can use the return value in a subsequent Open statement.

Format

FreeFile

Example

The following example opens a file and assigns to it the next file number that is available:

Sub Button_Click
   Dim filenumber As Integer
   Dim filename As String
   filenumber = FreeFile
   filename = "d:\temp\trace.txt"
   On Error Resume Next
   Open filename For Input As filenumber
   If Err <> 0 then
      Exit Sub
   End If
   Close #filenumber
End Sub

Related Topics

Open File Method

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