🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.msdos.programmer
Article #5559

Re: How to change Number of Open Files

#5559
From: Bruce R. Williams
Date: Mon, 01 Apr 1991 09:39
52 lines
2520 bytes
In article <1991Mar31.213543.28347@news.iastate.edu> tabu6@CCVAX.IASTATE.EDU writes:
>In article <1991Mar31.011139.8147@news.arc.nasa.gov>, chu@pioneer.arc.nasa.gov (Susie Chu RCS) writes:
>>Can someone tell me how to change the number of files that can 
>>be open simutaaneously?
>>My system is runing MSDOS 4.1 and I am using Turbo C 2.0.
>>I have a program that needs to open more than 20 files. I
>>have tried to
>>(1) in config.sys, change FILES=35
   [...]
>
>Try adding to config.sys the line:
>   BUFFERS=35
>(though that'll eat up RAM, it seems likely that you don't have enough
>buffers).


Hi!  I think I can help with this...  

It isn't a matter of how many buffers you have, it's a limit set inside DOS.
You're not stuck though...

With MS-DOS Versions 3.3 and later, there is a DOS function (int 21h,
function 67h), which allows you to specify the max. number of files that
may be open at one time.  Previous versions of DOS were limited to at most
20.

Since you are using MS-DOS 4.01 this will work.  If you need to write code
that is compatable with older versions, there is a work-around that involves
using your own table of file handles instead of DOS's.  See "MS-DOS Advanced
Programming" by Michael J. Young for a good example.

To use the DOS function:

  Set AH to 67h,
  Set BX to the new max number of file handles.
  Call Int 21h

  Upon return, if CF is 1 then there was an error and
  the error code is stored in AX.

Using Turbo C, this can all be done either by using inline assembly, or 
by using one of the C functions for calling interrupts: intdos, int86,
intr etc.

Good Luck!  I hope this was clear -- otherwise feel free to e-mail.


-Bruce

Bruce R. Williams                "The most beautiful thing we can experience
University of Utah                is the mysterious.  It is the source of all
(bwilliam@peruvian.utah.edu)      true art and science."  -Albert Einstein
Technical Details
Message-ID: <1991Apr1.023910.22196@hellgate.utah.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!cs.utexas.edu!hellgate.utah.edu!peruvian.utah.edu!bwilliam
References: <1991Mar31.011139.8147@news.arc.nasa.gov> <1991Mar31.213543.28347@news.iastate.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!cs.utexas.edu!hellgate.utah.edu!peruvian.utah.edu!bwilliam
From: bwilliam%peruvian.utah.edu@cs.utah.edu (Bruce R. Williams)
Newsgroups: comp.os.msdos.programmer
Subject: Re: How to change Number of Open Files
Summary: a solution
Message-ID: <1991Apr1.023910.22196@hellgate.utah.edu>
Date: 1 Apr 91 09:39:10 GMT
References: <1991Mar31.011139.8147@news.arc.nasa.gov> <1991Mar31.213543.28347@news.iastate.edu>
Organization: University of Utah CS Dept
Lines: 52