Mihran Hovsepyan Mihran Hovsepyan - 1 month ago 13
C++ Question

What is difference between TCHAR and WCHAR?

I've opened winnt.h header file and found there this two lines:

typedef wchar_t WCHAR;


and

typedef WCHAR TCHAR, *PTCHAR;


but there was comment in one of my posts that there is some difference between them. Then what is the difference?

Answer

If you read the entire header, you will find:

#ifdef _UNICODE
typedef WCHAR TCHAR;
#else
typedef char TCHAR;
#endif

or words to that effect.

Perhaps MS has removed the narrow option of late.

Comments