Win7-64
Win10-64
VC++ 16.9.4
I'm trying to use put_money to:
- insert a monetary symbol ($)
- insert locale separators for thousands/decimal point
In particular, for locale("en-US") if:
long double x = 1234567891;
cout << put_money(x) << endl;
then I would like to see something like $123,456.79 as output and the examples I've looked at seem to agree. Instead I see 123456.
My use of locale is:
# include <fstream>
# include <sstream>
# include <string>
ofstream repout;
void openFile(string filename) {
if (filename.empty()) {
cout << "Filename missing" << endl;
} else {
try {
repout.open(filename);
locale mylocale("");
repout.rdbuf()->pubimbue(mylocale);
} catch (exception& e) {
stringstream str;
str << "Unable to open: " << filename << ": " << e.what();
cout << str.str() << endl;
}
}
}; // int openFile(string filename)