I want to pipe the stdout of a child process that is created in the main program into a input stream owned by the main process.
I have a java equivalent to what I want to do, but I have no clue how to do this in C++
final Process p = Runtime.getRuntime().exec(/* Some process */);
final InputStream reader = p.getInputStream();
final byte[] buf = new byte[4096];
int offset;
while (p.isAlive()) {
offset = reader.read(buf);
if (offset == -1)
break;
// Do something with buf here
}