Possible Duplicate:
How to make this pipe work in c++?
In Linux, the following command will display the contents of textfile:
cat textfile
This output can be piped to a command like more like this:
cat textfile | more
I want to do this programmatically in c++. My program will first execute "cat textfile" by using execvp. Then it needs to capture the output from cat in stdout so that it can pipe this to more. I know how to make a pipe in c++. The problem is capturing stdout. How can this be done?