QBASIC.EXE max 16 files open at once. CONFIG FILES= no help

If you have questions about any aspect of QBasic programming, or would like to help fellow programmers solve their problems, check out this board!

Moderators: Pete, Mods

Post Reply
remery35
Newbie
Posts: 5
Joined: Fri Aug 27, 2010 7:29 pm

QBASIC.EXE max 16 files open at once. CONFIG FILES= no help

Post by remery35 »

I'm using QBASIC.EXE with Windows XP. Works very good except for the number of files that can be opened simlulataneously. The max seems to be about 16, after which even the HELP files cannot be found until after I execute the END statement in the immediate pane. So I have set inside C:\WINDOWS\SYSTEM32\CONFIG.NT,

files=400

and rebooted. That does not help. The QBASIC.EXE file is in the C:\OLDDOS directory, and so is the source code .BAS file. I have also tried .PIF and set that "Advanced" CONFIG file to files=( a lot ) and even used

device=c:\windows\system32\ansi.sys

as a test to make sure the CONFIG.SYS and/or CONFIG.NT was actually being read. As confirmation, I use the QBASIC SHELL statement to start a batch file, and inside that batch file are some ansi commands to change character colors, they work fine. But the number of simultaneously open files are still limited to 16 no matter what I do. That's too bad, since QBASIC.EXE works well on XP otherwise, running very fast.
User avatar
burger2227
Veteran
Posts: 2466
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Post by burger2227 »

Qbasic is limited as to that number of files you can open. If you can, store your file data in arrays and close those files to get more data.

OR you could use QB64 to run your program. It is a QBasic clone written in C to compile EXE files out of QB code. It also can run on VISTA and Windows 7 even with 64 bit.

The link is in my signature.

Ted

Mod
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
remery35
Newbie
Posts: 5
Joined: Fri Aug 27, 2010 7:29 pm

Reply

Post by remery35 »

Thanks. I'm curious though about why QBasic lists "file numbers" 1-255, but does not mention simultaneously open files. Is this because QBASIC was taken from QuickBasic 4.0 or 4.5 and they needed to apply this limitation?

I'm wondering, too. What's the difference between QBASIC 1.0 and 1.1, other than they came with DOS 5 and DOS 6, respectively?

I found QB45 to be interesting. It seems this would be a daunting project, since it would have to be backwards compatible with all the bugs in QBASIC.EXE. By the way, has anyone actually made a list of bugs in QBASIC.EXE ? ?
User avatar
burger2227
Veteran
Posts: 2466
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Post by burger2227 »

There are VAST improvements with each release. EVERYBODY fixes program bugs!

Qbasic was free while Quickbasic cost money because it had a compiler.

QB4.5 is the most popular and is still used by some businesses. However 64 bit and VISTA won't run anything but SCREEN 0 text windows. No fullscreen!

QB64 has many new things added plus it does not have the limitations of memory and such. MOST of the QB keywords are compatible. Only a few need added. I've never heard of anybody running out of files yet! It's free!
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
remery35
Newbie
Posts: 5
Joined: Fri Aug 27, 2010 7:29 pm

Thanks

Post by remery35 »

Thank for the answer. It seems that QB45 is great for converting QuickBasic 4.x programs over to QB45 to run on Windows 7 and Vista. An important tool when doing consulting work for some of these companies. :)
OPRESION
Veteran
Posts: 61
Joined: Tue Jan 16, 2007 4:15 am
Location: Mexico

Post by OPRESION »

HOW ARE YOU NUMBERING THE FILES THAT YOU OPEN?

ONCE I HAD AN ERROR MESSAGE LIKE "TOO MANY FILES" (OR SOMETHING
SIMILAR), BECAUSE TO OPEN FILES I WAS USING BIGGER NUMBERS.
FOR EXAMPLE I WAS USING:

OPEN "1" FOR INPUT AS 211
OPEN "2" FOR INPUT AS 222
OPEN "3" FOR INPUT AS 233
ETCETERA...

THE QB REALLY WAS BELIEVING I WAS OPENING TOO MANY FILES.
ARE YOU NUMBERING THEM ONE BY ONE WHEN YOU OPEN THEM?
MY PAGE: http://Qbasic.phatcode.net" target="_blank
(I ONLY USE WINDOWS 98SE YET, BELIEVE IT OR NOT)
remery35
Newbie
Posts: 5
Joined: Fri Aug 27, 2010 7:29 pm

Numbering files

Post by remery35 »

I'm numbering them automatically with the built-in FREEFILE function. This function seems to be very good at using the lowest unused number, so the numbers are never higher than necessary. My program scans files. Some lines contain a reference to another file. So rather than closing the first file, I simply open the second file, and when done scanning the second, continue scanning the first from where it left off. But if I were to close the first file, I would have to open it again and invoke the correct number of LINE INPUT #n, a$ commands, which slows the program down considerably. So I leave the files open for this reason. But the second file can have a reference to a third, and so forth. So I was putting a hard limit of 240 files open at once, since QB mentions that the numbers run from 1-255, and MS-DOS (NTVDM) can handle that many files at the same time with the FILES= command in CONFIG. With this program, 16 files open at once would be way too limiting, and I would be much better off using QB64. But I would very much like to find out some rhyme or reason as to why Microsoft likes to entice people by mentioning numbers 1-255, but NOT MENTION a 16 file limit in the "QBasic Environment Limits" section of the help.
User avatar
burger2227
Veteran
Posts: 2466
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Post by burger2227 »

They would not have set a limit for Windows if they didn't have to. When a file is opened part of it is loaded to memory for faster access. So even Windows has a limit or it could crash.

I can see no good reason to exceed the 15 file limit in QB as it would use too much memory and crash or slow down. My XP winces when I just open ONE QB program. It dgars when two are opened.

The other day, it would not load a preview window until I closed QB. Even QB64 loads it down a bit. It's a good idea to use sleep in "Press any key" loops too! It allows windows to share the CPU too. QB64 has _LIMIT to slow down loops or use less memory.

Ted
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
remery35
Newbie
Posts: 5
Joined: Fri Aug 27, 2010 7:29 pm

Post by remery35 »

I have Windows XP Home SP3. I have had 24 QBASIC.EXE's running at the same time. Yet I could still open a browser and browse the Internet. All 24 were running a loop waiting for user input. I also had all 24 in edit mode at the same time as well. And they would each respond quickly.

The trick was to use a .PIF to start each one using settings on how fast to recognize no user input. Different .PIF settings dramtically change the speed and response of NTVDM hosted MS-DOS programs like QBASIC.EXE.

Anyway, if QBasic tries to use the small MS-DOS memory for file management, why is QBasic even more restrictive than other MS-DOS programs in this regard? Windows XP itself could probably open upwards of 500 simultaneously without a problem. After all, I do have 489 MB RAM available to Windows.

So I'm wondering if NTVDM (comes free with Windows XP, and is installed by default), uses Windows protected mode to manage MS-DOS files? Or is this all done, including file management using virtual 8086 mode of the processor? I'm not sure.

Why "QBasic Environment Limits" mentions 1-255, but does not warn about a 15 file limit is still quite a mystery, since simultaneosuly open files is very much an environment limit if there ever was one.

As for recursive file scanning, sure there is a way to do this by storing file contents in very large arrays, which definitely would use up just as much memory as all those open files, even more. So in the end, is there a way to do this pattern of recursive file scanning without dramtically slowing down the program?

I'm looking for a QBASIC.EXE solution, since it's bugs are stable and this program is going into an industrial environment.
txwizard
Newbie
Posts: 2
Joined: Thu Dec 04, 2014 12:18 pm

Re: QBASIC.EXE max 16 files open at once. CONFIG FILES= no

Post by txwizard »

Although this thread is rather old, I decided that it was worthwhile to post a discovery that I just made about the "too many files" error that can happen when you attempt to build a project.

I have confirmed that the message is misleading, and that the real issue is that the length of the fully qualified name of the source file is too long. You can reproduce the error as follows.
  • Move or copy your source code to a directory that has a long name, where long means that the total length of the name string is greater than about 56 characters.
  • Start the QB editor, instructing it to load your main module and whatever quick libraries you need.
  • Attempt to build.
If your source code lives in a directory that has such a long name and you want it to stay there, you can circumvent the error as follows.
  • Share the directory that contains your source code or its immediate parent.
  • Use the share to map a drive to the shared directory.
  • Make the mapped drive the current working drive.
  • CD to the source code directory on the mapped drive.
  • Load the program into the editor and proceed as usual.
The reason that I know about this issue is that it reared its ugly head in a different form a number of years ago, and I ran down a blog post that outlined the issue and the workaround. Unfortunately, I have misplaced the URL, so I cannot cite my source. Nevertheless, I have many examples in my case files.
User avatar
burger2227
Veteran
Posts: 2466
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Re: QBASIC.EXE max 16 files open at once. CONFIG FILES= no

Post by burger2227 »

QB cannot use long file or folder names at all. It uses 8.3 naming conventions which require that long file names be called using ~n at the end of the first 8 letters where n is a number, normally 1. Folders are limited to 8 letters and numbers with ~n used for longer names.

QB still cannot open more than 14 or 15 files at one time no matter what they are called or where they are located.
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
txwizard
Newbie
Posts: 2
Joined: Thu Dec 04, 2014 12:18 pm

Re: QBASIC.EXE max 16 files open at once. CONFIG FILES= no

Post by txwizard »

burger2227 wrote:QB cannot use long file or folder names at all. It uses 8.3 naming conventions which require that long file names be called using ~n at the end of the first 8 letters where n is a number, normally 1. Folders are limited to 8 letters and numbers with ~n used for longer names.

QB still cannot open more than 14 or 15 files at one time no matter what they are called or where they are located.
Perhaps I didn't explain sufficiently clearly.

When you attempt to run a DOS program from a working directory with a long file name, the DOS program will either completely fail or behave strangely. Thankfully, it usually fails outright.

In the case cited here, the name of my working directory was C:\Documents and Settings\DAG\My Documents\Programming\QB4\WWDOSLOG, a string of 67 characters. Although the QuickBASIC integrated development environment started up without issue, selecting the Make EXE option from the Run menu caused a "too many files" error when the dialog box was processed.

Suspecting that the long path was part or all of the problem, I did as follows.
  • I shared directory C:\Documents and Settings\DAG\My Documents\Programming\QB4\, naming the share QB4_SRCE.
  • I created a mapped drive letter (Z:) from the share, \\ZAPHOD42\QB4_SRCE.
  • I changed the current directory to Z:\WWDOSLOG.
  • I opened the QuickBASIC editor and successfully built the program.
This is by no means my first encounter with this long path name issue. I first encountered it several years ago, when one of my stalwart batch file utility programs refused to run whenever the current directory had a long name, even if it was a proper 8.3 name.
User avatar
burger2227
Veteran
Posts: 2466
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Re: QBASIC.EXE max 16 files open at once. CONFIG FILES= no

Post by burger2227 »

The same thing can happen in other Windows programs. That's probably one reason that they did away with "Documents and Settings" also.

The number of files opened limit is a DOS memory problem, not a folder name problem.
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
Post Reply