What is TCHAR and how does it differ from WCHAR?

770 views Asked by At

This question should've had an answer nowadays here, but there is nothing explaining what exactly TCHAR is on stackoverflow (all I found is an explanation of the difference between TCHAR and _TCHAR).

All I know is that TCHAR and _TCHAR are considered to be the same and on some platforms TCHAR may be the same as WCHAR. But all that is just a presumption.

What is TCHAR and how does it differ from WCHAR?

2

There are 2 answers

2
ikegami On BEST ANSWER

TCHAR is either char or wchar_t depending on whether UNICODE is defined or not.

Using TCHAR and TCHAR-based types allow a library to work with programs that define UNICODE and programs that don't alike.

2
User On

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