Problem And Question
How can I convert a std::string
to LPCSTR
? Also, how can I convert a std::string
to LPWSTR
?
I am totally confused with these LPCSTR
LPSTR
LPWSTR
LPCWSTR
?
Are LPWSTR
and LPCWSTR
are the same?
Best Solution And Answer
str.c_str()
gives you a const char *
, which is an LPCSTR
(Long Pointer to Constant STRing) — means that it’s a pointer to a 0
terminated string of characters. W
means wide string (composed of wchar_t
instead of char
).