Basically I am making a Python program and part of it needs to run a C++ executable, I am calling the exe with:
subprocess.call(["C:\\Users\\User\\Documents\\Programming\\Python\\Utilities\\XMLremapper\\TranslatorSource\\FileFixer.exe", "hi"])
But how do I make the C++ program read the input? I tried:
FILE * input = popen("pythonw.exe", "r");
cout<< input.getline() << endl << endl;
But that just outputs 0x22ff1c
and definitely not "hi". What code is needed to pipe the input into the C++ program?
They are passed as parameters to the main
function.
main(int argc, char *argv[])
argc
is the length of argv
. So it would be
main(int argc, char *argv[])
{
cout<<argv[1];
return 0;
}