What the difference between LPCSTR
, LPCTSTR
and LPTSTR
?
Why do we need to do this to convert a string into a LV
/ _ITEM
structure variable pszText
:
LV_DISPINFO dispinfo;
dispinfo.item.pszText = LPTSTR((LPCTSTR)string);
To answer the first part of your question:
LPCSTR
is a const string
LPCTSTR
is a const TCHAR
string, (TCHAR
being either a wide char or char depending on whether UNICODE is defined in your project)
LPTSTR
is a (non-const) TCHAR
string
This is a great codeproject article describing C++ strings (see 2/3 the way down for a chart comparing the different types)
Quick and dirty:
LP
== Long Pointer. Just think pointer or char*
C
= Const, in this case, I think they mean the character string is a const, not the pointer being const.
STR
is string
the T
is for a wide character or char (TCHAR) depending on compile options.