Tuesday, 6 August 2013

wstringstream default format flag

wstringstream default format flag

I am trying to convert 3 byte double to string. Following is my code.
double b = 0xFFFFFF;
std::wstring ss;
std::wstringstream sOut;
sOut << b;
ss = boost::lexical_cast<std::wstring>(sOut.str());
I expect output to be 16777215. But "ss" has the value 1.67772e+007.
However when I use "fixed" flag, I get the expected output.
sOut << std::fixed
My question is whether wstringstream has "scientific" flag by default ?
Thanks,

No comments:

Post a Comment