Most string operations can use the same logic for Unicode and for Windows code pages. The only difference is that the basic unit of operation is a 16-bit character (also known as a wide character) for Unicode and an 8-bit character for Windows code pages. The Windows header files provide several type definitions that make it easy to create sources that can be compiled for Unicode or for Windows code pages.
// Generic types #ifdef UNICODE typedef wchar_t TCHAR; #else typedef unsigned char TCHAR; #endif typedef TCHAR *LPTSTR, *LPTCH; // 8-bit character specific typedef unsigned char CHAR; typedef CHAR *LPSTR, *LPCH;
The letter "T" in a type definition, for example, TCHAR or LPTSTR, designates a generic type that can be compiled for either Windows code pages or Unicode. The letter "W" in a type definition, for example, WCHAR or LPWSTR, designates a Unicode type. Because Windows code pages are of the older form, they have simple type definitions, such as CHAR and LPSTR.
http://msdn.microsoft.com/en-us/library/windows/desktop/dd374131(v=vs.85).aspx