I have an exe file written in C, and I'm running this file from PHP using shell_exec(). I intend to run this file in pretty much the same way that we get using command prompt. The problem is when the program encounters a 'scanf' statement(or any such statement that requires listening for user input), it does not listen for the input, and instead continues with the execution assuming some random input, or even blank input. I need PHP to wait for the user to provide some input, the same way as happens when executing from cmd. How do I solve this problem?
Asked
Active
Viewed 304 times
0
-
1One solution would be to modify your c program to take commandline parameters. Check out http://stackoverflow.com/questions/2390604/how-to-pass-variables-as-stdin-into-command-line-from-php/2390755#2390755 – Ananth Oct 24 '14 at 19:37
-
No I very specifically need to accept runtime user inputs. I've specified my requirements in the question, and that's exactly what I need... nothing else – YouKnowWho Oct 25 '14 at 11:03
-
Okay, the url i pasted above directly links to the answer for this. Or else search that page for "proc_open" – Ananth Oct 25 '14 at 17:29