www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/06/25/20:56:50

To: Paul Lancette <lancette AT teleview DOT com DOT sg>
Cc: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: Re: Problems opening > 20 files when using FOPEN
Return-Receipt-To: peter AT deakin DOT edu DOT au
Date: Mon, 26 Jun 1995 10:42:55 +1000
From: Peter Horan <peter AT deakin DOT edu DOT au>

> Please help...
> I felt so lucky with djgpp...no problems all the way..smooth ride until now.
> I cannot open more than 20 files at same time when using FOPEN.
> Working with 486-dos6.2. To use djgpp compiler my app needs to open more than
> 20 files. i did what the book said:
> -increased my config to files=60
> -increased handles count in JFT (Job File Table) to 40 using INT21H, func 67H
> 
> If i do a low level open using OPEN command, i can open 34 (ex files open 
> by systemm). BUT if i use FOPEN, i cannot open more than 15 files(streams)
> and get an error msg " too many files open"
> 
In UNIX, the number of file descriptors is limited to 20, numbered 0 to 19. 
This limit is a function of the library. Descriptors 0, 1 and 2 correspond to 
stdin, stdout and stderr. In Microsoft (and Borland? and djgpp?) compilers, 
stdprn and stdaux are also defined and opened by the system leaving you with 
15. 

So, you have two choices - restructure your solution, or write your own 
library. I would choose to re-draft my own code, because I know it, and 
because my software would run on a UNIX system as well as an MSDOS system. 

Simple things to do are 
	close files once used (e.g. stdprn and stdaux), 
	read input data files one at a time and hold in buffers, 
	hold output data in buffers and write them one at a time when finished.

Peter Horan                     School of Computing and Mathematics
peter AT deakin DOT edu DOT au	   	Deakin University
                                Geelong
+61-52-27 1234 (Voice)          Victoria 3217
+61-52-27 2028 (FAX)            Australia

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019