函式功能及返回值:設定、改變或返回當前的地域信息,若成功則返回一個指向地域信息字元串的指針
所屬庫:locale.h或wchar.h
基本介紹
- 外文名:_wsetlocale
- 函式原型:wchar_t *_wsetlocale等
- 程式示例:// crt_setlocale.cpp等
- 相關函式:setlocale、localeconv
C語言函式,函式簡介,參數說明,程式示例,
C語言函式
函式簡介
函式名稱:_wsetlocale
函式原型:
wchar_t *_wsetlocale(
int category,
const wchar_t *locale
);
相關函式:setlocale、localeconv
參數說明
詳見
程式示例
// crt_setlocale.cpp
//
// This program demonstrates the use of setlocale when
// using two independent threads.
//
#include <locale.h>
#include <process.h>
#include <windows.h>
#include <stdio.h>
#include <time.h>
#define BUFF_SIZE 100
// Retrieve the date and time in the current
// locale's format.
int get_time(unsigned char* str)
{
__time64_t ltime;
struct tm thetime;
// Retieve the time
_time64(<ime);
_gmtime64_s(&thetime, <ime);
// Format the current time structure into a string
// using %#x is the long date representation,
// appropriate to the current locale
if (!strftime((char *)str, BUFF_SIZE, "%#x",
(const struct tm *)&thetime))
{
printf("strftime failed!\n");
return -1;
}
return 0;
}
// This thread sets its locale to German