Mail Archives: djgpp/1996/03/19/11:14:44
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.
- Raw text -