in reply to problem with system(), stdin, and stdout

Now, output that *should* be going to ">outfile" is actually being printed/redirected to the screen.

Could you give us a short a short runnable program that demonstrates this?

And are you sure the child is writing to its STDOUT and not its STDERR? Try

system("somecmd -args >outfile 2>&1");