我想将输入发送到我的服务器并希望服务器运行我的 C++ 程序。生成输出并响应我的输出以显示在浏览器上。
最佳答案
最简单的 CGI 应用如下所示:
#include <iostream>
using namespace std;
int main ()
{
cout << "Content-type:text/html\r\n\r\n";
cout << "<html>\n";
cout << "<head>\n";
cout << "<title>Hello World - First CGI Program</title>\n";
cout << "</head>\n";
cout << "<body>\n";
cout << "<h2>Hello World! This is my first CGI program</h2>\n";
cout << "</body>\n";
cout << "</html>\n";
return 0;
}
关于javascript - 从我的浏览器运行 C++ 程序,发送输入并显示输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29240206/