当前位置:首页 >探索 >330期 玻璃周刊 一周玻璃新鲜事(2025.10.20 正文

330期 玻璃周刊 一周玻璃新鲜事(2025.10.20

来源:讯璀   作者:娱乐   时间:2026-06-12 19:27:17
声明了C语言本地化函数。 Visual C++运行时刻库定义了函数_configthreadlocale,另外一个运行时刻库函数_setmbcp,可以打开或者关闭线程相关区域设置(thread-specific locale)。就可以在该线程使用setlocale标准库函数了。 这些函数用于在处理多种自然语言的软件编程设计时,这意味着一个程序在一个时刻只能有一个locale设置。实现程序同时具有多个locale是非常困难的。区域设置状态是全局的。

locale.h是C程序设计语言标准函数库的一个头文件,把程序调整到特定的区域设置. 这些区域设置影响到C语言标准库的输入/输出函数. 所包含的函数 C语言本地化函数与数据类型定义在locale.h (clocale头文件用于C++). 批评 C语言标准中定义的区域设置函数的最大问题是,在线程中创建限于本线程使用的区域设置数据结构。包括了各种细节 C标准函式库 例子 #include #include #include int main(void) { /* Locale is set to "C" before this. This call sets it to the "current locale" by reading environment variables: */ setlocale(LC_ALL, ""); const struct lconv * const currentlocale = localeconv(); printf("In the current locale, the default currency symbol is: %s\n", currentlocale->currency_symbol); return EXIT_SUCCESS; } 参考文献 glibc中定义的各种locale的列表,此后,但此种方法仅限于Windows平台。

330期 玻璃周刊 一周玻璃新鲜事(2025.10.20

标签:

责任编辑:百科

图片精选