home *** CD-ROM | disk | FTP | other *** search
Wrap
<?xml version="1.0" encoding="utf-8"?> <html><head><title>FreeFile Function[Runtime]</title><meta name="filename" content="text/sbasic/common/03020102"/><help:css-file-link xmlns:help="http://openoffice.org/2000/help"/><!--The CSS style header method for setting styles--><style type="text/css"> p.P1{ } span.T1{ font-weight:bold;} </style></head><body> <help:to-be-embedded Eid="freefile" xmlns:help="http://openoffice.org/2000/help"> <p class="Head1"><help:link Id="66512">FreeFile Function[Runtime]</help:link></p> <p class="Paragraph">Returns the next available file number for opening a file. This is useful if you want to open a file in addition to other open files and want to ensure that the file number is not already in use.</p> </help:to-be-embedded> <p class="Paragraph"><span class="T1">Syntax</span>:</p> <p class="Paragraph">FreeFile <help:key-word value="FreeFile" tag="kw66512_1" xmlns:help="http://openoffice.org/2000/help"/></p> <p class="Paragraph"><span class="T1">Return value</span>:</p> <p class="Paragraph">Integer</p> <p class="Paragraph"><span class="T1">Parameter</span>:</p> <p class="Paragraph">This function should be used immediately before an Open statement. FreeFile returns the next available file number, but does not reserve it.</p> <p class="Paragraph"><span class="T1">Example:</span></p> <p class="PropText">Sub ExampleWorkWithAFile</p> <p class="PropText">Dim iNumber As Integer</p> <p class="PropText">Dim sZeile As String</p> <p class="PropText">Dim aFile As String</p> <p class="PropText">Dim sMsg as String</p> <p class="PropText">aFile = "c:\data.txt"</p> <p class="PropText">sMsg = = ""</p> <p class="PropText">iNumber = Freefile</p> <p class="PropText">Open aFile For Output As #iNumber</p> <p class="PropText">Print #iNumber, "First line of text"</p> <p class="PropText">Print #iNumber, "Another line of text"</p> <p class="PropText">Close #iNumber</p> <p class="PropText"/> <p class="PropText">iNumber = Freefile</p> <p class="PropText">Open aFile For Input As #iNumber</p> <p class="PropText">While not eof(#iNumber)</p> <p class="PropText">Line Input #iNumber, sLine</p> <p class="PropText">If sLine <>"" then</p> <p class="PropText">sMsg = sMsg & sZeile & chr(13)</p> <p class="PropText">end if</p> <p class="PropText">wend</p> <p class="PropText">Close #iNumber</p> <p class="PropText">Msgbox sMsg</p> <p class="PropText">End Sub</p> <p class="PropText"/> </body></html>