TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Rob Hamerling
from: Mike Phillips
date: 1997-01-11 03:13:20
subject: Re: `temp` redirect

-07 Jan 97  16:31:26-

=Rob Hamerling babbled to All about 'temp' redirect=



 RH> A couple of questions about redirecting output.



 RH> From my own program I want to spawn() another program but don't want

 RH> to see its stdout (and stderr) output. I understand that with



Open a pair of annonymous pipes.  Dupe the handle of the read pipe to

stdout and stderr.  Dupe the handle of the write pipe to stdin.  The

spawn off your program in such a way that it inherits the environment.

(See your compiler's documentation) You can do what you want with what

comes through the read handle (display it in a window, process it, junk

it, etc.), and you can write to the program's stdin if you like. 



 RH> stdout and stderr simultaneously? After returning from the spawned

 RH> program I want to resume normal stdout handling as it was before the

 RH> spawn(). How is that possible?  Should I close the file pointer I got

 RH> from freopen()? 



Save stdout, stderr, and stdin before duping the handles (dupe the std

handles to temp handles and then dupe the pipe handles).



Mike Phillips

INTERNET:  phil4086{at}utdallas.edu



... HUNTERS do it with bigger guns.

--- FMail 1.0g
* Origin: oOo The Pit Viper oOo (1:124/2145)
SEEN-BY: 50/99 54/99 270/101 620/243 625/0 160 711/401 409 410 413 430 808
SEEN-BY: 711/809 934 955 712/311 407 505 506 517 623 624 704 841 713/317
SEEN-BY: 800/1
@PATH: 124/2145 2342 1 396/1 270/101 712/624 711/808 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.