Mail Archives: djgpp/1998/07/19/07:01:42
On Fri, 17 Jul 1998, Jorge Ivan Meza Martinez wrote:
> I use system to launch a child program,
> it generates stdout and stderr,
> I am interested in take this data to be shown in my program,
> how can I do that in a portable way ?
If you only need to capture stdout, use `popen' and `pclose' instead
of `system'.
If you need stderr as well, you will need to redirect handle 2 to a
file (using `dup'/`open'/`dup2' paradigm) before you call either
`system' or `popen', and then read the redirected output from the file
after the child process returns.
All of the functions mentioned above are fairly portable.
- Raw text -