i want to code with unicode , but im not sure that WCHAR and wchar_t which one is better
This is a discussion on about char type within the Windows Programming forums, part of the Platform Specific Boards category; i want to code with unicode , but im not sure that WCHAR and wchar_t which one is better...
i want to code with unicode , but im not sure that WCHAR and wchar_t which one is better
Effectively, they are the same thing. One just tends to be used when specifically programming windows applications.Originally Posted by WinNT.h
In Windows your best bet is to use #define UNICODE at the top of your source files then use the TCHAR and PTCHAR types for strings.
There are also a number of string and path functions defined that are "unicode smart"... lstrcpy() lstrcat() etc. and Path____() all work with unicode, using THCARs, as do most windows function calls.
A TCHAR is defined as...
Code:#ifdef UNICODE typedef wchar_t TCHAR typedef wchar_t* PTCHAR #else typedef char TCHAR typedef char* PTCHAR #endif
I don't recommend using TCHAR's. It's added level of abstraction and effort that is no longer needed in new development for Windows.
gg