我有一个php文件启动我的exe.exe执行cout并且文本以html格式打印,这一切都很好.直到我写"someline \n"; \n打破输出,我只看到最后一行.如何打印/回显其中包含多行的文本/字符串?
当前的粘贴已经注释掉,我的文本打印正常.它在控制台看起来很丑陋,当我用IE7查看源码时(虽然我主要用FF浏览),看起来很痛苦.这是我目前的php和cpp文件
<html>
<head>
</head>
<body>
<?php
echo( exec('c:/path/to/exe/launchMe.exe hey lol hi') );
?>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
CPP
#include <string>
#include <iostream>
#include <sstream>
using namespace std;
const string htmlLine(string s)
{
s+= "<br />";
// s += "\n";
return s;
}
int main(int argc, char *argv[])
{
stringstream s;
s << argc;
cout << htmlLine("woot") << htmlLine(s.str());
for (int i=0; i<argc; ++i)
{
s.str("");
s << i << " = " << argv[i];
cout << htmlLine(s.str());
}
return 0;
}
Run Code Online (Sandbox Code Playgroud)