[ACCEPTED]-What is difference between TCHAR and WCHAR?-winapi

Accepted answer
Score: 20

If you read the entire header, you will 2 find:

#ifdef _UNICODE
typedef WCHAR TCHAR;
typedef char TCHAR;

or words to that effect.

Perhaps MS 1 has removed the narrow option of late.

Score: 11

TCHAR can be either char or WCHAR based on the platform. WCHAR is 1 always a 16-bit Unicode character, wchar_t.

Score: 7



A WCHAR if UNICODE is defined, a 3 CHAR otherwise.


A 16-bit Unicode character. For 2 more information, see Character Sets Used 1 By Fonts.

Score: 0

Technically speaking there is no difference 6 because you cannot typedef two different 5 entities to a single one. Let us See An 4 Example...

typedef char a;
typedef char  b;
typedef a b, c;

This Definition Works But If a 3 Change The Above Definition To This

typedef char a;
typedef char * b;
typedef a b, c;

Error 1 error C2040: 'b' : 'a' differs in levels of indirection from 'char *'

Another One

typedef char a;
typedef int b;
typedef a b, c;

Error 1 error C2371: 'b' : redefinition; different basic types

So 2 By Analyzing These Things Only Same Type 1 Can Defined Together.

More Related questions