c++: subprocess output to stdin
Suppose I want to call a subprocess from within my program, and I want to read the output from that subprocess into my program. Here is a trivial way to do that: //somefile.cpp system("sub_process arg1 arg2 -o file.out"); //call the subprocess and have it write to file FILE *f = std::fopen("file.out", "r"); //.... and so on We all know that i/o operations are computationally slow. To speed this up, I would like to skip the write-to-file-then-read-from-file step, and instead redirect the output of this sub-process directly into stdin (or some other stream) How would I do this? How do I skip the