Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个函数可以返回一个字符串const char *:
const char *
const char* get_text();
我需要调用一个函数AfxMessageBox(LPCTSTR text)。
AfxMessageBox(LPCTSTR text)
如何转换我得到的字符串get_text()?
get_text()
当您使用 MFC 并假设 UNICODE 构建时(否则您不会遇到此错误!),可能最简单的方法是直接实例化wchar_t兼容CString:
wchar_t
CString
CStringW szWide(getText()); AfxMessageBox(szWide);