"too many files" runtime error

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

"too many files" runtime error

Post by Hank » Wed Mar 08, 2006 9:39 pm

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

RyanKelly
Coder
Posts: 48
Joined: Sun Jan 22, 2006 6:40 pm
Contact:

Post by RyanKelly » Wed Mar 08, 2006 9:59 pm

Have you tried the original program with the file handle limit set higher than 23? DOS itself keeps at least 4 file handles open at all times. I'm not sure if this is your problem, but it might be a good place to start.

Valerie
Newbie
Posts: 8
Joined: Sun Jul 24, 2005 4:23 am

Too many files

Post by Valerie » Fri Mar 10, 2006 4:43 am

Error code 67?

Any chance you have gone over the limit of the number of files in the root directory?

See here...
________
Hiroshima Plant

Post Reply