Path: utzoo!yunexus!maccs!cs3b3aj From: cs3b3aj@maccs.McMaster.CA (Stephen M. Dunn) Newsgroups: comp.sys.ibm.pc Subject: Re: MS-DOS puzzle #1 Summary: too lazy to write it in Keywords: stdin stdout stderr redirection Message-ID: <2515@maccs.McMaster.CA> Date: 23 Apr 89 03:46:27 GMT Article-I.D.: maccs.2515 References: <6893@bsu-cs.bsu.edu> Reply-To: cs3b3aj@maccs.UUCP (Stephen M. Dunn) Organization: McMaster U., Hamilton, Ont., Can. Lines: 25 In article <6893@bsu-cs.bsu.edu> dhesi@bsu-cs.bsu.edu (Rahul Dhesi) writes: > Question: Why does COMMAND.COM allow redirection of standard > input and standard output, but not standard error? As I understand it, when you say "<", MS-DOS closes file handle 0 (STDIN) and then opens the file you specified. Since it uses the lowest available handle, it ends up redirecting STDIN. Ditto for STDOUT redirection. (This explanation condensed from _Advanced MS-DOS_, Ray Duncan, Microsoft Press). Why can't you redirect STDERR (or, for that matter, STDAUX or STDPRN)? Because they didn't write in a facility as in *NIX so that you could specify the handle number to be redirected. Why? Probably because they (read the powers that be at Microsoft, not the guys who coded it) figured there wasn't enough demand for this feature to justify writing it. I can't see that it would take that much extra code to implement *NIX- style redirection of any handle, but to be honest, I've never needed to redirect anything other than STDIN or STDOUT (I'm not saying there's no need to do so, just that I've never needed to do so). -- ====================================================================== ! Stephen M. Dunn, cs3b3aj@maccs.McMaster.CA ! DISCLAIMER: ! ! Goddamn exams! I hate them! I hate them! ! I'm only an undergrad ! ======================================================================