New Locale-dependent C Runtime Functions

use _create_locale()  and _vcprintf_l() instead setLocale()

 

In "POSIX" style locale support on Windows?, Michael Kaplan, the Technical Lead for Windows Globalization, describes the existing locale-dependent functions in the C Runtime (CRT) as "unwieldy". To compare strings, for example, using a different locale than is currently set for the process or thread you must call setlocale() to set the desired locale and to get the old locale, call the function or functions, then call setlocale() again using the old locale. Someone Michael mentions in his blog suggests that locale-dependent functions should accept a locale instead, like the managed String.Compare() method. The CRT shipping with Whidbey adds that capability using the new locale-dependent functions that are similar to the old functions, but end in _l and accept a parameter of type _locale_t, like _stricmp_l(). As an alternative to setting and resetting the process or thread locale, you can create and store a _locale_t variable returned from _create_locale() that accepts the same parameters as setlocale(). When appropriate, the Secure CRT functions - similar in nature to the functionality that strsafe.h provides - are defined to accept a locale, like strncpy_s_l().

 

http://blogs.msdn.com/b/heaths/archive/2005/03/06/386080.aspx

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值