Click here to Skip to main content
15,887,485 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: wchar_t in C Pin
Jochen Arndt17-Dec-17 0:33
professionalJochen Arndt17-Dec-17 0:33 
GeneralRe: wchar_t in C Pin
jschell18-Dec-17 15:30
jschell18-Dec-17 15:30 
GeneralRe: wchar_t in C Pin
Jochen Arndt18-Dec-17 21:12
professionalJochen Arndt18-Dec-17 21:12 
GeneralRe: wchar_t in C Pin
jschell23-Dec-17 12:50
jschell23-Dec-17 12:50 
GeneralRe: wchar_t in C Pin
Anonygeeker14-Dec-17 17:25
Anonygeeker14-Dec-17 17:25 
GeneralRe: wchar_t in C Pin
Jochen Arndt14-Dec-17 20:48
professionalJochen Arndt14-Dec-17 20:48 
GeneralRe: wchar_t in C Pin
Anonygeeker14-Dec-17 21:53
Anonygeeker14-Dec-17 21:53 
AnswerRe: wchar_t in C Pin
leon de boer14-Dec-17 7:08
leon de boer14-Dec-17 7:08 
It's defined as a wide char for Unicode & UTF16 support primarily for filename name support (FAT32 LFN for example) and foreign console input.

There is also another important type in <wchar.h> which is wint_t which is the generic carrier form.

You need the concept of narrowing which take a wide character back to it's byte approximation (see function wctob).
wctob | Microsoft Docs[^]
The reverse concept is widening which takes a byte character and promotes it (see function btowc)
btowc | Microsoft Docs[^]

The letter conversions are controlled by the current LC_TYPE locale meaning the language type

Type something like this .. it prints the time in japanese Smile | :)
C
#include <wchar.h>
#include <locale.h>
#include <time.h>

int main(void){

   wchar_t str[100];	
   time_t t = time(0);
   setlocale(LC_ALL, "ja-JP");
   wcsftime(str, 100, L"%A %c", localtime(&t));
   wprintf(L"%Ls\n", str);
}

It will look something like "金曜日 2017/12/15 2:09:13"
In vino veritas

QuestionMFC libary makefile Pin
jung-kreidler12-Dec-17 4:29
jung-kreidler12-Dec-17 4:29 
QuestionRe: MFC libary makefile Pin
David Crow13-Dec-17 6:54
David Crow13-Dec-17 6:54 
AnswerRe: MFC libary makefile Pin
jung-kreidler13-Dec-17 21:14
jung-kreidler13-Dec-17 21:14 
AnswerRe: MFC libary makefile Pin
Richard MacCutchan13-Dec-17 7:37
mveRichard MacCutchan13-Dec-17 7:37 
GeneralRe: MFC libary makefile Pin
jung-kreidler13-Dec-17 21:17
jung-kreidler13-Dec-17 21:17 
AnswerRe: MFC libary makefile Pin
Randor 13-Dec-17 11:16
professional Randor 13-Dec-17 11:16 
AnswerRe: MFC libary makefile Pin
jung-kreidler13-Dec-17 21:23
jung-kreidler13-Dec-17 21:23 
Questioncurrent user Pin
john563211-Dec-17 19:14
john563211-Dec-17 19:14 
AnswerRe: current user Pin
Jochen Arndt11-Dec-17 23:02
professionalJochen Arndt11-Dec-17 23:02 
AnswerRe: current user Pin
Victor Nijegorodov12-Dec-17 8:34
Victor Nijegorodov12-Dec-17 8:34 
AnswerRe: current user Pin
jschell12-Dec-17 11:38
jschell12-Dec-17 11:38 
GeneralRe: current user Pin
Richard MacCutchan12-Dec-17 22:09
mveRichard MacCutchan12-Dec-17 22:09 
GeneralRe: current user Pin
jschell14-Dec-17 7:40
jschell14-Dec-17 7:40 
GeneralRe: current user Pin
David Crow12-Dec-17 15:42
David Crow12-Dec-17 15:42 
Questionunsigned and signed in C Pin
Anonygeeker11-Dec-17 18:45
Anonygeeker11-Dec-17 18:45 
AnswerRe: unsigned and signed in C Pin
Shaurya Sinha11-Dec-17 19:23
professionalShaurya Sinha11-Dec-17 19:23 
GeneralRe: unsigned and signed in C Pin
Anonygeeker11-Dec-17 20:01
Anonygeeker11-Dec-17 20:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.