Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!pt.cs.cmu.edu!b.gp.cs.cmu.edu!Ralf.Brown@B.GP.CS.CMU.EDU From: Ralf.Brown@B.GP.CS.CMU.EDU Newsgroups: comp.os.msdos.misc Subject: Re: Max files open Message-ID: <270db93a@ralf> Date: 6 Oct 90 11:00:10 GMT Sender: ralf@b.gp.cs.cmu.edu Organization: Carnegie Mellon University School of Computer Science Lines: 42 In-Reply-To: <1990Oct5.223922.2798@herald.usask.ca> In article <1990Oct5.223922.2798@herald.usask.ca>, hovdesta@herald.usask.ca (Alfred Hovdestad) wrote: }From article <659@demott.COM>, by kdq@demott.COM (Kevin D. Quitt): }> In article <6548@castle.ed.ac.uk> elev66@castle.ed.ac.uk (G Gaston) writes: }>> No matter what I set "FILES=" in CONFIG.SYS }>>the maximum files that I can open is 15. Is there any way in which this }>>can be increased. }> }It also depends on your DOS version. Some versions of DOS (as recently }as 3.20) allow FILES=[>20] but in reality could only accomodate 20 }files. After allowing 5 for stdin, stdout, stderr, com1 and lpt1, you }are left with 15. Your best bet would be to upgrade your version of }DOS. [if this isn't already in the Frequently-Asked Questions list, it should be] There are no fewer than THREE different open-file limits: system-wide, per- process, and runtime-library. The system-wide limit is set by FILES=, and may be up to 255 in all versions of DOS since 2.00. Each time a file is opened, one of the tables reserved by the FILES= statement is used; multiple file handles may point at the same table either through inheritance on EXEC or explicit duplication with the DUP or FORCEDUP INT 21h calls. The per-process limit is set by the open file table in the process's PSP; versions 2.xx are hardwired with a 20-byte OFT in the PSP (although it is possible to get more than 20 open files by messing directly with the OFT). Versions 3.00 and up contain a pointer and length field, allowing you to copy the open file table elsewhere and increase its length; versions 3.30 and up include a documented system call to let you do so. The runtime-library limit is enforced in languages such as C/C++ which need to keep information about the file such as text vs. binary mode. Both Turbo C and Microsoft C use an array of size 20 for that information, and the only way to break that limit without recompiling parts of the runtime library is to provide your own replacement file I/O routines. -- UUCP: {ucbvax,harvard}!cs.cmu.edu!ralf -=- 412-268-3053 (school) -=- FAX: ask ARPA: ralf@cs.cmu.edu BIT: ralf%cs.cmu.edu@CMUCCVMA FIDO: 1:129/3.1 Disclaimer? | I was gratified to be able to answer promptly, and I did. What's that? | I said I didn't know. --Mark Twain