Date: Fri, 14 Mar 2003 16:57:34 -0800
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "David L. Cassell" <cassell.david@EPAMAIL.EPA.GOV>
Subject: Re: exec win2k resource utilities
Content-type: text/plain; charset=us-ascii
Huck <huck@FINN.NOSPAM.COM> replied informedly:
> there is a discussion going on over in comp.lang.perl.moderated about
> this, the thread titled "Win32: Ways of redirecting STDOUT and STDERR
> of external pgm at the same time?"
> one repsonder "Louis Erickson" suggested
> >$rc = system("program > foo.txt 2>&1");
> >You'll have to make sure buffering doesn't bite you there, but that
> >does what you want. It looks just like how you'd do it under Unix.
> >Works in Windows 2000 and anything newer, and probably in NT4. Can't
> >speak for 98/ME, etc. I suspect they don't work.
If *all* the relevant output for our original poster is coming from
stderr, the buffering is probably not an issue. Alternatively,
telling Perl to set
might suffice. This is the output autoflush (default is 0, buffering
Since there is a potential problem with this approach on some windows
OSsa, it may be better within Perl to go ahead and open up a filehandle
for stderr and read it explicitly, tossing it afterward at stdout via
the print() function.
David Cassell, CSC
Senior computing specialist