Date: Tue, 19 Mar 1996 18:05:35 +0200 (IST) From: Eli Zaretskii To: Dominic Hibbs Cc: "x DOT pons AT cc DOT uab DOT es" , djgpp AT delorie DOT com Subject: Re: Opening more than 45 files (again) In-Reply-To: Message-Id: Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII On Tue, 19 Mar 1996, Dominic Hibbs wrote: > > `stderr' is also connected to CON by default. But you are wrong about > > the 5 handles. From the system (DOS) point of view, only 3 files are > > open: CON (3 times), PRN and AUX. > > > Isn't that the same? - I know that handles 0 to 4 are in use by the above > and that the first file handle allocated when a file is opened is number > 5. Opening COM1 (AUX) gives me file handle 3 and LPT1 gives me 4. > stderr is accessed on a different handle and is not normally redirectable > while stdin and stdout are. You are mixing two different things. Your program indeed has 5 used handles, but DOS uses only 3 entries in its SFT (system file table), it just sets the ``use count'' for CON to 3. The FILES= setting defines the size of the SFT when DOS boots; the size of the file handle table that the C library functions use is a different, if related, issue. The library functions `dup' and `dup2' are only possible because several different file handles can be associated with the same SFT entry in the DOS internals.