New Locale-dependent C Runtime Functions
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().