[comp.os.msdos.programmer] DOS or Turbo bug: you be the judge...

dpw@sei.cmu.edu (David Wood) (10/19/90)

PLEEEEEEEEASE HELP!!!!!!

I have a problem that does not seem to be documented in any of my
stacks of DOS and Turbo-C manuals.  I am attempting to use DOS
function 67h to increase available file handles.  I need to insert
this capability into a rather large program (~250K executable), so I
tried it out first in a small test program.

Here's the problem: if I compile the test program using the SMALL
memory model (or medium), everything works fine.  However, if I
compile it using the LARGE model, it doesn't work: it allows me to
open any number of files using open(), but as soon as I try to open
one with fopen(), DOS allocates all available memory and the open
fails.  After some trial-and-error, I found that this problem only
manifests itself if I request DOS to permit 49 or more file handles.
If I request 48 or less, everything works as expected.  I've tried to
vary the FILES= value, but with no effect.

I have implemented the DOS interrupt call both via calls to intdos()
as well as via inline assembly code; the thing malfunctions either
way.

Does anyone out there know if this is a DOS bug, a Turbo C (actually
Turbo C++) bug, or am I just doing something wrong?  

Another note: if I run the PD program FILES33 (a TSR to increase file
handles limit), before running my test program, everything works fine.
However, neither FILES33 nor my test program work properly
independently.  Unfortunately, I need to have a single executable, so
this solution is not adequate.

SPECS: I'm running on an 8M 386 with DOS 4.0 and Turbo C++.  I need to
be able to open up to about 150 files using open() and about 10 using
fopen().

Thanks to anyone who can help.  E-mail is preferred; if I get a
solution e-mailed to me, I'll post the solution after testing it out.

--Dave Wood
-- 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~