followup to my "too many files" error posting

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
Hank
Newbie
Posts: 2
Joined: Wed Mar 08, 2006 8:16 pm

followup to my "too many files" error posting

Post by Hank »

Thanks to RyanKelly and Valerie for their interest. As I mentioned in my
initial posting, I tried altering the "files=" line in config.sys without success
(I tried files= 23, files=30, files=100 for example). I didn't know about
the restriction that DOS places on the number of files that can be present
in the root directory, but my C:\ directory currently contains only 51 files,
well short of the 512 limit that Valerie refers to. I appreciate any other
suggestions that you and other programmers may have.

Hank

Initial posting:

I?ve written a PDS 7.1 (QuickBasic) program that requires 18 + 5 = 23
files to be opened simultaneously (I know that some programmers will
argue that no one ever needs to have this many files open at one time,
but let?s suppose for the purpose of this discussion that they?re wrong).
My operating system is Windows 98 SE with a 20 GB hard drive and 128
MB RAM. To override DOS? default limit of 15 + 5 = 20 files, I included in
my source code the lines

InRegs.AX = &H6700
InRegs.BX = 23
CALL INTERRUPT(&H21, InRegs, OutRegs)

The object and executable programs were created with no problem using
the bc and link commands. However, when I run the .EXE program
(about 135,000 bytes), I get a ?too many files? at such and such address
error message. I tried altering the ?files =? line in config.sys, but that
doesn?t help. A very short test program I wrote just to see if 25 files
(InRegs.BX = 30) can be opened at the same time works ok, so this
suggests to me that the problem may have something to do with memory
accessibility. Using SETMEM in the larger .EXE to release additional
memory didn?t work either, although this is to be expected since BASIC
allocates as much memory as possible to the far heap when a program
starts.
By restricting the values of two parameters I have been able to open
16 + 5 = 21 files simultaneously and successfully run a modified version
of the .EXE. But this modification severely limits what the program is
intended to do. I used the FRE function in both the original and
modified .EXEs to give you an idea of what memory resources are
available when each program is run:

FRE(0) FRE(-1) FRE(-2) SETMEM(0)
--------- ---------- ---------- ----------------
Original .EXE 45432 459304 4046 474112
Modified .EXE 45448 460312 4046 475088

FRE(0) returns the remaining space in DGROUP (in bytes)
FRE(-1) returns the remaining space in far memory for DOS (in bytes)
FRE(-2) returns the remaining stack space (in bytes)
SETMEM(0) returns the current size of the far heap (in bytes)

There doesn?t seem to be that big a difference in the memory available to
each program, but as I?ve mentioned the original .EXE generates a ?too
many files? error message whereas the modified .EXE does not. I
appreciate any ideas you may have on how I can get the original .EXE to
run successfully (I?m hoping for something akin to a CALL INTERRUPT that
can be included in the source code, although of course I will be grateful
for just about anything that will work). Thanks.

Hank
User avatar
Zim
Veteran
Posts: 98
Joined: Mon Dec 05, 2005 4:31 pm
Location: Wisconsin, USA
Contact:

Post by Zim »

All I remember is the limit to the number of files on a 5-1/4" floppy in the root directory. It's 120, and 119 if the disk has a label. The label is simply a file name (directory entry) with a special (label) flag. (Maybe that's a 360K disk, too; it's been so long...)
--- Zim ---
--- Time flies like an arrow, but fruit flies like a banana ---
Post Reply