Since I forgot this twice already, I'm writing it here so I can search for it later. And if it helps someone else, that's even better! char is a single byte (8 bits) representation of a character, in a written language. wchar_t also represents a character in a written language and can be a single byte or more depending on how the compiler is configured. Microsoft defines wchar_t to be two bytes (16 bits) and to store characters in UTF-16. WCHAR is a typedef for wchar_t. TCHAR is a typedef for char or WCHAR depending on the compiler's configuration. If the compiler is in ANSI or Multi-Byte mode then TCHAR is char. If the compiler is in Unicode mode then TCHAR is WCHAR. The LP[x[x]]xxx are typedefs used for defining variables that store addresses to arrays of that type in memory. LPSTR is (char *) - a pointer to the first char in a string of chars. LPCSTR is (const char *) - the same as LPSTR, but the string can't be changed. LPWSTR is (WCHAR *) - a pointer to the first WCHAR in a string of WCHARs. LPCWSTR is (const WCHAR *) - the same as LPWSTR, but the string can't be changed. LPTSTR is (TCHAR *) - a pointer to the first char or WCHAR in a string of chars or WCHARs. LPCTSTR is (const TCHAR *) - the same as LPTSTR, but the string can't be changed. |
Blog >