Microsoft KB Archive/31053

= QB.EXE &quot;Path/File Access Error&quot; Running Out of File Handles =

Article ID: 31053

Article Last Modified on 11/21/2006

-

APPLIES TO


 * Microsoft QuickBasic 4.0
 * Microsoft QuickBASIC 4.0b
 * Microsoft QuickBasic 4.5 for MS-DOS
 * Microsoft BASIC Compiler 6.0
 * Microsoft BASIC Compiler 6.0b
 * Microsoft BASIC Professional Development System 7.0

-



This article was previously published under Q31053



SUMMARY
When running a program in the QB.EXE editor, simultaneously OPENing more file handles than are allowed in DOS generates the error message &quot;path/file access error.&quot; An &quot;illegal function call&quot; error message is then displayed if the Shell command from the File menu is used.

To get the QB.EXE editor to work correctly again, type CLOSE in the immediate window to free the open file handles.

Note that when you use DOS Version 3.30, you can perform an interrupt hex 21, function CALL hex 67, to obtain more than 15 DOS file handles available to Basic programs.

This information applies to QuickBasic Versions 4.00, 4.00b, and 4.50, to the QB.EXE editor in Microsoft Basic Compiler Versions 6.00 and 6.00b for MS-DOS, and to the QBX.EXE editor in Microsoft Basic PDS Version 7.00 for MS-DOS.



MORE INFORMATION
MS-DOS Versions 3.30 and later allow more than 20 files when you use the FILES=20 statement in the DOS CONFIG.SYS file; however, QuickBasic only recognizes up to 20 files by default.

Because QuickBasic reserves the five default MS-DOS file handles for standard input/output, a program cannot OPEN more than 15 files at one time. If no FILES=N statement exists in the DOS CONFIG.SYS file, the default is FILES=8, which leaves three files for the program.

QuickBasic uses the following five files by default:


 * 1) Standard input: INPUT from the console (CON:) by default
 * 2) Standard output: PRINT to the console (CON:) by default
 * 3) Standard error messages: to the console (CON:) by default
 * 4) Standard list: LPRINT to the printer (PRN:) by default
 * 5) Standard auxiliary (AUX:) devices, that is, communication ports (COM1 or COM2) or printer ports (LPT1 or LPT2)

To work around the DOS file-handle limitation, do the following:

  Make sure your DOS CONFIG.SYS file on the root directory of your boot disk includes the following statement:      FILES=20  In Basic programs, CLOSE each file before OPENing the next one. Do not simultaneously OPEN more than the number of files established in the CONFIG.SYS file, minus five for DOS. The maximum number of OPEN files is 15 when you specify FILES=20 in the CONFIG.SYS file. When using DOS Version 3.30, you can perform an interrupt hex 21, function CALL hex 67, to obtain more than 20 file handles available to Basic. For more information, query on the following words in this database:

67 and 3.30 and 21 and files



The following code example demonstrates the QuickBasic QB.EXE editor (or QBX.EXE editor from Basic PDS Version 7.00) problem that occurs when you exceed the DOS file-handle limit: REM This program will exceed the file handle limit and cause an error. FOR i = 1 TO 20 OPEN &quot;z&quot; + CHR$(i + 64) FOR RANDOM AS i PRINT i NEXT i CLOSE   ' This CLOSE statement is never reached. After running this program, you must type the CLOSE command in the immediate window, or else SHELL will give you an &quot;Illegal Function Call&quot; error.

Additional query words: QuickBas BasicCom

Keywords: KB31053

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.