Jas
06-16-2008, 04:43 PM
I created my very first C++ program :) And now I want to call it from PHP. The problem that I have is that the inputs are on different lines. I.E.:
program.exe
What's your name: <name>
What's your username: <username>
output here
How can I run an exec() function to fill in those inputs? I tried variations of:
echo exec("cd path/to/program/ && program.exe\nJas\nJas\n");
and
$out = array();
echo exec("cd path/to/program/ && program.exe\nJas\nJas\n",$out);
print_r($out);
But it doesn't work. Any thoughts?
If this won't work, is there an alternate way to input those without using a flat file or putting all the vars on one line?
program.exe
What's your name: <name>
What's your username: <username>
output here
How can I run an exec() function to fill in those inputs? I tried variations of:
echo exec("cd path/to/program/ && program.exe\nJas\nJas\n");
and
$out = array();
echo exec("cd path/to/program/ && program.exe\nJas\nJas\n",$out);
print_r($out);
But it doesn't work. Any thoughts?
If this won't work, is there an alternate way to input those without using a flat file or putting all the vars on one line?