close - close a file


close [[#]FileNum[, [#]FileNum]...]


The close statement closes the indicated files.  Each FileNum may be any numeric expression.  The value of each FileNum should match the FileNum given in a previous open statement for the file that is to be closed.  If no FileNum is given, all open files are closed. 

After closing a file, the file and its file number are no longer associated and subsequent I/O operations using this file number will be invalid until the file number is specified in another open statement.  Once a file is closed, its file number is free to be used for a subsequent open of the same file or any other file.  Similarly, the file just closed may be reopened with the same file number or any other unused file number. 

When a file previously opened for sequential output is closed, the output buffer is automatically flushed prior to the close. 


The program lines
	v = 1
	close v, #2, #v+2
cause the files associated with file numbers 1, 2, and 3 to be closed. 

The statement

causes all open files to be closed. 


open, reset, end, system, stop


If FileNum is less than 1 or greater than the maximum number of files allowed, a "Bad file number" error occurs. 


In Basmark QuickBASIC, the maximum number of files that may be open simultaneously is 15; this limitation is imposed by UNIX. 

from The Basmark QuickBASIC Programmerís Manual by Lawrence Leinweber