FreeFile Function[Runtime]/text/sbasic/shared/03020102.xhpSun Microsystems, Inc.converted from old format - fpeFreeFile functionFreeFile Function[Runtime]Returns the next available file number for opening a file. Use this function to open a file using a file number that is not already in use by a currently open file.Syntax:FreeFileReturn value:IntegerParameters:This function can only be used immediately in front of an Open statement. FreeFile returns the next available file number, but does not reserve it.Example:Sub ExampleWorkWithAFileDim iNumber As IntegerDim sLine As StringDim aFile As StringDim sMsg as StringaFile = "c:\data.txt"sMsg = ""iNumber = FreefileOpen aFile For Output As #iNumberPrint #iNumber, "First line of text"Print #iNumber, "Another line of text"Close #iNumberiNumber = FreefileOpen aFile For Input As #iNumberWhile not eof(#iNumber)Line Input #iNumber, sLineIf sLine <>"" thensMsg = sMsg & sLine & chr(13)end ifwendClose #iNumberMsgbox sMsgEnd Sub