c++: subprocess output to stdin
If you happen to be on windows :
follow this : http://support.microsoft.com/kb/190351
It describes it better than I ever would. You can redirect everything, everywhere.
Using popen
skips the file, and gets you command's output through an in-memory buffer.
#include <iomanip>
#include <iostream>
using namespace std;
const int MAX_BUFFER = 255;
int main() {
string stdout;
char buffer[MAX_BUFFER];
FILE *stream = popen("command", "r");
while ( fgets(buffer, MAX_BUFFER, stream) != NULL )
stdout.append(buffer);
pclose(stream);
cout << endl << "output: " << endl << stdout << endl;
}