www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/03/19/11:14:44

Date: Tue, 19 Mar 1996 18:05:35 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Dominic Hibbs <mtx064 AT coventry DOT ac DOT uk>
Cc: "x DOT pons AT cc DOT uab DOT es" <ILGES AT cc DOT uab DOT es>, djgpp AT delorie DOT com
Subject: Re: Opening more than 45 files (again)
In-Reply-To: <Pine.OSF.3.91.960319105508.14770A-100000@leofric>
Message-Id: <Pine.SUN.3.91.960319175604.20848T-100000@is>
Mime-Version: 1.0


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 -


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