I've been experimenting with piping to external programs in the last few days and have gain no grounds.
Code:
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
string aa = "test";
echo -e aa | test2.exe; // doesn't work
system("aa | test2.exe "); //doesn't work either
system("PAUSE");
return EXIT_SUCCESS;
}
Code for test2.exe:
Code:
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
string bb;
cout << "Please enter stuff: ";
cin >> bb;
cout << bb;
system("PAUSE");
return EXIT_SUCCESS;
}
It would be nice if someone could tell me how to make a pipe. It seems quite simple from those tutorials, however I just can't seem to grasp it and make it work in my code.