【发布时间】:2010-09-04 00:32:43
【问题描述】:
我有以下代码执行 C++ 程序并输出它:
<html>
<head>
<title>C++</title>
</head>
<body>
<div><?php
system("app.exe", $out);
echo rtrim($out, "0");
?></div>
</body>
</html>
我怎样才能做到你可以将参数传递给 c++ 程序,像这样说......
如果这是 c++ 程序
#include <iostream>
#include <string>
int main(){
string input = getarg();//Not really a function, just one I kinda want to know
cout << input;
return 0;
}
我可以这样做吗?
<html>
<head>
<title>C++</title>
</head>
<body>
<div><?php
system("app.exe arg=hello-world", $out);
echo rtrim($out, "0");
?></div>
</body>
</html>
我不知道这个问题的很多部分,我可以执行程序但我只是需要传递参数。
【问题讨论】:
标签: php c++ system executable exec