X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f Date: Mon, 26 Feb 2007 18:48:06 -0500 Message-Id: <200702262348.l1QNm6a0007058@envy.delorie.com> From: DJ Delorie To: Gordon DOT Schumacher AT seagate DOT com CC: djgpp AT delorie DOT com In-reply-to: (Gordon DOT Schumacher AT seagate DOT com) Subject: Re: pipe, spawn, and redirecting stdout for child process? References: Errors-To: nobody AT delorie DOT com > Is there a way in DJGPP to use the spawn*() functions and capture > stdout of the spawned process via a pipe? Is there an example of > that somewhere? Not with a pipe. You have to dup2() the stdin/out/err descriptors to temp files for the child program. > I've tried looking at the source code to redir but I'm just not > putting it together. Consider this unix example: $ prog1 > /tmp/foo.$$ $ prog2 < /tmp/foo.$$ > /tmp/bar.$$ $ prog3 < /tmp/bar.$$ This is the same as "prog1 | prog2 | prog3" but without pipes. > Perhaps this is just a case of me not figuring out how to mesh the > UNIX-ish way of doing it with the DOS-ish way... :-P I understand > how to do it using fork but obviously that's not an option here. Another option is to look at the pexecute module in gcc's libiberty, which encapsulates all the different ways of running programs with stdin/stdout/pipe stuff all hidden away.