I have the following code that executes a C++ program and outputs it:
<html>
<head>
<title>C++</title>
</head>
<body>
<div><?php
system("app.exe", $out);
echo rtrim($out, "0");
?></div>
</body>
</html>
How can I make it so that you can pass arguments to the c++ program, say like this...
If this was the c++ program
#include <iostream>
#include <string>
int main(){
string input = getarg();//Not really a function, just one I kinda want to know
cout << input;
return 0;
}
Could I do something like this?
<html>
<head>
<title>C++</title>
</head>
<body>
<div><?php
system("app.exe arg=hello-world", $out);
echo rtrim($out, "0");
?></div>
</body>
</html>
I don't know a lot of parts to this problem, I can execute the program but I just need to pass arguments.
You can pass the arguments space separated after the command like
system("app.exe hello-world 2 3", $out);
in your c++ program