To: Paul Lancette 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 > 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