In a project I am currently working on I link to a proprietary dynamic library. As soon as I run the library's initialize
function, the behavior of logging and printing of numbers changes.
Commas have been inserted at every third decimal. Ie.
cout << 123456789 << endl
used to print out 123456789
and now it prints 123,456,789
. This is horribly annoying, because this behavior is not what I want.
After some research I suspect a locale issue. I have tried using this line of code after calling the initialize
function
setlocale(LC_ALL,"C");
thinking it might reset my local to the default; but to no avail. The commas persist!!
What am I missing?
I have posted a related follow on question here.
stringstreams
andcouts
as well. Is there a better way to globally set the local, instead of going through all the source code for my libraries and adding inimbue(std::locale("C"))
for every stringstream I find? – Fpc