tags:

views:

32

answers:

1

I need std::locale class, that defines ru_RU.CP1251 standart facets (ctype, collate, numeric, …). I feel sombody have released all main locales. Is there a libraries, or source files storage where I can download it and just include in my project like this, for example:

#include <some_lib\ru_locale.hpp> // library
#include <locale>
#include <io>

int main(int argc, char *argv[])
{
  std::locale ru = ru_locale(); // from library
  std::locale custom_locale(std::locale(""), ru, numpunct);
  std::cout.imbue(custom_locale);
  float float_num = 1.123;
  std::cout << float_num;
  return 0;
}
A: 

What's wrong with just doing:

std::locale ru("ru_RU.cp1251");

It seems quite suerfluous to make a specific class for that?

rubenvb
I don't know what locales installed in the users system. For example, mingw (binaries from sourceforge) + windows doesn't have ru_RU.cp1251, so your code throws exception.
hoxnox