J
Jean-Gael GRICOURT
I am trying to use ostringstream in binary mode. Why the value (0x0A)
is automatically replaced by (0x0D,0x0A) in the output ? Is there a
workaround to this issue ?
-------- my snippet code -------
#include <iostream>
#include <sstream>
using namespace std;
int main(int argc, char **argv) {
char buf[512];
ostringstream oss (ostringstream:ut | ostringstream::binary);
buf[0] = 0x0A;
oss.write(buf, 1);
cout << oss.str();
return 0;
}
-------- output -------
a.exe > data.txt
A binary dump of data.txt gives: 0D 0A and not 0A as expected.
is automatically replaced by (0x0D,0x0A) in the output ? Is there a
workaround to this issue ?
-------- my snippet code -------
#include <iostream>
#include <sstream>
using namespace std;
int main(int argc, char **argv) {
char buf[512];
ostringstream oss (ostringstream:ut | ostringstream::binary);
buf[0] = 0x0A;
oss.write(buf, 1);
cout << oss.str();
return 0;
}
-------- output -------
a.exe > data.txt
A binary dump of data.txt gives: 0D 0A and not 0A as expected.