Re:What are TCHAR, WCHAR, LPSTR, LPWSTR, LPCTSTR?
by lsh123 on Sunday June 15, 2014 @01:16AM
(#7894484)
This is really simple (I don't write code for Windows for more than 7 years but I still remember it):
CHAR - standard C character (one byte)
WCHAR - two bytes Unicode character
TCHAR - either CHAR or WCHAR depending on your compiler options (hint: all Windows system functions have both versions to support ASCII or Unicode and this is an easy way to write code once)
LPXXX - "long pointer" to XXX ("long" comes from the old times, just ignore - this is a pointer)
LPCXXX - "long pointer" to a constant string (in C you can't just do "const LPXXX" since it will mean the pointer itself is
constant, thus the "const" keyword should actually be "inside" the definition)
CHAR - standard C character (one byte)
WCHAR - two bytes Unicode character
TCHAR - either CHAR or WCHAR depending on your compiler options (hint: all Windows system functions have both versions to support ASCII or Unicode and this is an easy way to write code once)
LPXXX - "long pointer" to XXX ("long" comes from the old times, just ignore - this is a pointer)
LPCXXX - "long pointer" to a constant string (in C you can't just do "const LPXXX" since it will mean the pointer itself is constant, thus the "const" keyword should actually be "inside" the definition)