問題描述
如何將 std::string
轉(zhuǎn)換為 LPCSTR
?另外,如何將 std::string
轉(zhuǎn)換為 LPWSTR
?
How can I convert a std::string
to LPCSTR
? Also, how can I convert a std::string
to LPWSTR
?
我完全對(duì)這些LPCSTR
LPSTR
LPWSTR
和LPCWSTR
感到困惑.
I am totally confused with these LPCSTR
LPSTR
LPWSTR
and LPCWSTR
.
LPWSTR
和 LPCWSTR
是一樣的嗎?
推薦答案
str.c_str()
給你一個(gè) const char *
,它是一個(gè) LPCSTR
(Long Pointer to Constant STRing) -- 表示它是一個(gè)指向以 0
結(jié)尾的字符串的指針.W
表示寬字符串(由 wchar_t
而不是 char
組成).
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
).
這篇關(guān)于如何將 std::string 轉(zhuǎn)換為 LPCSTR?的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!