I
ids
Hi,
Is it possible to display the output of a child program on the console
AND capture it at the same time by redirecting to a file?
Say I have a Makefile and a program that invokes 'gmake' using:
01) system("gmake -f Makefile");
OR
02) system("gmake -f Makefile > build_report.txt");
OR
03) popen("gmake -f Makefile 2>&1", "r");
(01) will write the stdout and stderr of 'gmake' to the console. (02)
allows me to capture the stdout, but it sends only the stderr to the
console. (03) helps to capture both stdout and stderr, but it hides
both from the console.
What I'm looking for is a method to capture both stderr and stdout and
display to the console at the same time. Is there a way to do that?
Thanks,
ids.
Is it possible to display the output of a child program on the console
AND capture it at the same time by redirecting to a file?
Say I have a Makefile and a program that invokes 'gmake' using:
01) system("gmake -f Makefile");
OR
02) system("gmake -f Makefile > build_report.txt");
OR
03) popen("gmake -f Makefile 2>&1", "r");
(01) will write the stdout and stderr of 'gmake' to the console. (02)
allows me to capture the stdout, but it sends only the stderr to the
console. (03) helps to capture both stdout and stderr, but it hides
both from the console.
What I'm looking for is a method to capture both stderr and stdout and
display to the console at the same time. Is there a way to do that?
Thanks,
ids.