Xref: news-dnh.mv.net comp.os.msdos.djgpp:597 Path: news-dnh.mv.net!mv!news.sprintlink.net!howland.reston.ans.net!agate!sunsite.doc.ic.ac.uk!ulcc.ac.uk!pluto.ulcc.ac.uk!cziwkga From: cziwkga AT pluto DOT ulcc DOT ac DOT uk (Kevin Ashley) Newsgroups: comp.os.msdos.djgpp Subject: Re: Problems opening > 20 files when using FOPEN Date: 26 Jun 1995 11:51:28 GMT Organization: University of London Computer Centre Lines: 37 Distribution: world References: Reply-To: k DOT ashley AT ulcc DOT ac DOT uk Nntp-Posting-Host: pluto.ulcc.ac.uk To: djgpp AT sun DOT soe DOT clarkson DOT edu Dj-Gateway: from newsgroup comp.os.msdos.djgpp In article , Peter Horan writes: |>> |>> 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. |> The statement 'in UNIX, the number of file descriptors is limited to 20' is incorrect in my experience. Peter then qualifies this by saying that the limit is a function of the library. This IS true if we take 'file descriptors' to mean 'streams', which is what fopen is creating for us. The libraries on most systems I have used set the limit at 256, a number much greater than 20. One is also limited by the number of file descriptors the OS is willing to supply which is often smaller, but usually at least 64 in any self-respecting system. DOS may well limit us to 15. In all environments, one should be able to interrogate the system to discover the maximum number of file descriptors and streams, and any program which expects to run on multiple platforms + open lots of files would be well advised to do so. I'm not near my djgpp system at the moment so can't check if returns something sensible for STREAM_MAX and OPEN_MAX, which is what POSIX says should return the relevant values. ------------------------------------------------------------------------------ Kevin Ashley K DOT Ashley AT Ulcc DOT ac DOT uk Systems Development Group Manager http://www.ulcc.ac.uk/staff/Kevin+Ashley University of London Computer Centre. ...ukc!ncdlab!K.Ashley This is not a signature