如何获得语言环境名称为我的线程
How to get the locale name for my thread?
比如说,我可以在我的C程序中使用_create_locale设置语言环境,如下所示:
localeUS = _create_locale(LC_ALL, "English_United States.1252");
但是我需要的是相反的,即为调用线程检索区域名称(上述函数的第二个参数)。知道怎么做吗?
p。我知道现代Windows使用lcd。为了与旧代码兼容,我需要这个区域设置名称。
希望你能使用标准c++。
从std::语言环境::名称:
例子#include <locale>
#include <iostream>
#include <string>
int main()
{
std::locale loc(std::locale(), new std::ctype<char>);
std::cout << "The default locale is " << std::locale().name() << 'n'
<< "The user's locale is " << std::locale("").name() << 'n'
<< "A nameless locale is " << loc.name() << 'n';
}
输出:The default locale is C
The user's locale is en_US.UTF8
A nameless locale is *
相关文章:
- 我使用 OpenMP 的线程越多,执行时间就越长,这是怎么回事?
- c++ 为什么我不应该从不同的线程解锁互斥锁
- 我需要线程函数在不停止实际程序的情况下,每2秒打印一次随机数
- 为什么我的线程不在后台运行?
- 为什么我的线程永远不会结束
- 我可以在没有任何锁的情况下从不同的线程读取内存缓冲区吗?
- 我可以在使用 omp_set_num_threads 后使 OpenMP 恢复到理想的线程 # 吗?
- 睡眠:(睡眠或usleep)并没有将我的线程中的所有内容悬挂在Linux中,而是在Windows中悬挂吗?为什么
- 为什么我不能编译这个简单的线程测试?
- 我可以在没有静音的线程中读取线程中的bool变量
- 为什么我的变量在单独的线程中修改时没有改变?C++/boost
- 寻找对我的线程安全,无锁队列实施的批评
- 我的线程程序有什么问题
- 为什么valgrind(helgrind)在我的线程结构上调用虚函数时生成"Possible Data Races"
- 我的线程工作不好,它给出了所有结果,最后没有一个接一个,GUI 在线程运行期间挂起?
- 为什么我的线程被一个关键部分阻塞,而没有被任何东西抓住
- 为什么我的线程没有运行?
- 如何获得语言环境名称为我的线程
- 为什么我的线程不能优雅地退出?
- 为什么我的线程调用函数对象而不是将其返回值分配给packaged_task的未来对象