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?
TCHAR is just a macro - if Unicode is defined as the character set for the project it maps. to wchar_t. So in that case there is no difference between them. if Unicode is NOT defined as the character set for the project it maps to char.
This document sets out the walking, cycling and horse-riding assessment and review (WCHAR) process for highway schemes on motorways and all-purpose trunk roads.
For Unicode platforms, TCHAR is defined as synonymous with the WCHAR type. MAPI clients can use the TCHAR data type to represent a string of either the WCHAR or char type. Be sure to define the symbolic constant UNICODE and limit the platform when it is required.
tchar. h defines macros (which have the prefix _tcs ) that, with the correct preprocessor definitions, map to str , _mbs , or wcs functions, as appropriate. To build MBCS, define the symbol _MBCS . To build Unicode, define the symbol _UNICODE . To build a single-byte application, define neither (the default).
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With