1
1
---
2
2
title : " setlocale, _wsetlocale"
3
3
description : " Describes the Microsoft C runtime (CRT) library functions setlocale and _wsetlocale."
4
- ms.date : 4/20/2023
4
+ ms.date : 01/04/2024
5
5
api_name : ["_wsetlocale", "setlocale", "_o__wsetlocale", "_o_setlocale"]
6
6
api_location : ["msvcrt.dll", "msvcr80.dll", "msvcr90.dll", "msvcr100.dll", "msvcr100_clr0400.dll", "msvcr110.dll", "msvcr110_clr0400.dll", "msvcr120.dll", "msvcr120_clr0400.dll", "ucrtbase.dll", "api-ms-win-crt-locale-l1-1-0.dll"]
7
7
api_type : ["DLLExport"]
@@ -12,7 +12,7 @@ no-loc: [setlocale, _wsetlocale]
12
12
---
13
13
# ` setlocale ` , ` _wsetlocale `
14
14
15
- Sets or retrieves the run-time locale.
15
+ Set or retrieve the run-time locale.
16
16
17
17
## Syntax
18
18
@@ -258,9 +258,8 @@ int get_date(unsigned char* str)
258
258
return 0;
259
259
}
260
260
261
- // This thread sets its locale to the argument
262
- // and prints the date.
263
- uintptr_t __ stdcall SecondThreadFunc( void* pArguments )
261
+ // This thread sets its locale to the argument and prints the date.
262
+ unsigned __ stdcall SecondThreadFunc(void* pArguments)
264
263
{
265
264
unsigned char str[ BUFF_SIZE] ;
266
265
char * locale = (char * )pArguments;
@@ -298,7 +297,7 @@ int main()
298
297
// Create the second thread with a German locale.
299
298
// Our thread function takes an argument of the locale to use.
300
299
hThread = (HANDLE)_beginthreadex( NULL, 0, &SecondThreadFunc,
301
- "de-DE", 0, &threadID );
300
+ (void*) "de-DE", 0, &threadID );
302
301
303
302
if (get_date(str) == 0)
304
303
{
@@ -316,10 +315,10 @@ int main()
316
315
317
316
```Output
318
317
The thread locale is now set to en-US.
319
- The time in en-US locale is: 'Wednesday, May 12, 2004 '
318
+ The date in en-US locale is: 'Thursday, January 4, 2024 '
320
319
321
320
The thread locale is now set to de-DE.
322
- The time in de-DE locale is: 'Mittwoch, 12. Mai 2004 '
321
+ The date in de-DE locale is: 'Donnerstag, 4. Januar 2024 '
323
322
```
324
323
325
324
## See also
0 commit comments