LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (March 2003, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 14 Mar 2003 16:57:34 -0800
Reply-To:     cassell.david@EPAMAIL.EPA.GOV
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

$|=1;

might suffice. This is the output autoflush (default is 0, buffering for stdout).

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.

HTH, David -- David Cassell, CSC Cassell.David@epa.gov Senior computing specialist mathematical statistician


Back to: Top of message | Previous page | Main SAS-L page