bclose - close BASIC file


short fn;




Bclose closes the file given by fn using doclose (see initio(io)). 

Breset closes all files, also using doclose

These functions implement the CLOSE and RESET statements. 

For the aggrandizement of those so inclined, lclose closes the line printer (see filel(io)).  Using doclose, this function effectively terminates the line printer process (if any), allowing for example a spooler to initiate physical printing or the line printer process to be reassigned in midstream.  This function constitutes a blatant extension to the BASIC language and is, therefore, not directly supported by the syntax of the language.  Nevertheless, the invocation of this function can be coded easily enough in a BASIC source program with the statement: “CALL LCLOSE.”

Files are closed automatically on exit or when the process receives any common signal.  Attempting to close a file which is not open is not an error. 


bend(err), runerr(err), initio(io), filel(io)
close(stmt), reset(stmt), call(stmt)


Bclose generates error 52 (Bad file number) if fn is out of range. 


With the exception of the diagnostic defined above, the reporting of errors that occur during file closing is deferred as long as possible in the hope of completing other, independent file closing tasks thus leaving the file as properly closed as possible.  In any case, the file will be labeled closed.  Thus a reported error may represent many although no means of repair is available and no additional tinkering is likely useful.  Such errors are decidedly rare and tend to exist at the operating system and filesystem levels implying aggravation of these.  Trapping and especially ignoring such errors is, therefore, not advisable. 

from The Basmark QuickBASIC Programmer’s Manual by Lawrence Leinweber