本文介紹了如何將 std::string 轉換為 LPCSTR?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
如何將 std::string
轉換為 LPCSTR
?另外,如何將 std::string
轉換為 LPWSTR
?
How can I convert a std::string
to LPCSTR
? Also, how can I convert a std::string
to LPWSTR
?
我完全對這些LPCSTR
LPSTR
LPWSTR
和LPCWSTR
感到困惑.
I am totally confused with these LPCSTR
LPSTR
LPWSTR
and LPCWSTR
.
LPWSTR
和 LPCWSTR
是一樣的嗎?
推薦答案
str.c_str()
給你一個 const char *
,它是一個 LPCSTR
(Long Pointer to Constant STRing) -- 表示它是一個指向以 0
結尾的字符串的指針.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
).
這篇關于如何將 std::string 轉換為 LPCSTR?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!