If you don't need to know which parts are from stderr, and which are from stdout, i would suggest appending
2>&1 to your command. This will cause the unix shell to rediect them both so you can read them.
On the other hand, if they have to be seperate, i would suggest :
- using pipe() twice
- fork()'ing off a child.
- Using open() in the child to reset STDOUT and STDERR to the writing ends of the pipes.
- using exec() in the child to start the command
- let the parent (from the fork()) read the other ends of the pipes, and process them seperatly.
... just a thought.
i had a memory leak once, and it ruined my favorite shirt.