I've been trying quite a few combinations on this one but this is the only one that works. Basically what I'm trying to do is replace "\r\n" with 2 spaces. The full code is given below. Is there a way of coding the section in blue in one line?
Code:
#include <iostream>
#include <algorithm>
#include <string>
#include <sstream>
using namespace std;
const char EOL[] = "\r\n";
int main ()
{
ostringstream msg;
string logger;
int aaa = 1, bbb = 99, ccc = 1234;
msg << "Param 1 " << aaa << EOL
<< "Param 2 " << bbb << EOL
<< "Param 3 " << ccc;
logger = msg.str ();
cout << "Screen output " << logger.c_str() << endl;
[COLOR=BLUE]
replace (logger.begin(), logger.end (), '\r', ' ');
replace (logger.begin(), logger.end (), '\n', ' ');
[/COLOR]
cout << "log output " << logger.c_str() << endl;
return 0;
}