How to get current locale of my environment?

前端 未结 5 600
挽巷
挽巷 2020-12-28 13:06

Had tried following code in Linux, but always return \'C\' under different LANG settings.

#include 
#include 
#i         


        
5条回答
  •  一向
    一向 (楼主)
    2020-12-28 13:46

    Just figured out how to get locale by C++, simply use an empty string "" to construct std::locale, which does the same thing as setlocale(LC_ALL, "").

    locale l("");
    cout<<"Locale by C++: "<

    This link described differences in details between C locale and C++ locale.

提交回复
热议问题