The output of a command is directed to STDOUT. we can redirect this to a file for our use.
To read both a command's STDOUT and its STDERR separately, it's easiest and
safest to redirect them separately to files, and then read from those files
when the program is done: system("program args 1>/tmp/program.stdout 2>/tmp/program.stderr");
Gentoo