我必须将两个CString
变量和两个long
变量
连接在一起CString
。我找到了一个我使用过的 Format 函数,如下所示:
CString str = "Some Data";
str.Format("%s%d", str, 123);
但它给出了错误。这是错误日志:
\AudWinSockXCtrl.cpp(410) : error C2440: 'initializing' : cannot convert from 'const char [10]' to 'ATL::CStringT'
with
[
BaseType=wchar_t,
StringTraits=StrTraitMFC
]
Constructor for class 'ATL::CStringT' is declared 'explicit'
with
[
BaseType=wchar_t,
StringTraits=StrTraitMFC
]
.\AudWinSockXCtrl.cpp(411) : error C2664: 'void ATL::CStringT::Format(const wchar_t *,...)' :
cannot convert parameter 1 from 'const char [5]' to 'const wchar_t *'
with
[
BaseType=wchar_t,
StringTraits=StrTraitMFC
]
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or
function-style cast
.\AudWinSockXCtrl.cpp(414) : error C2664: 'void ATL::CStringT::Format(const wchar_t *,...)' :
cannot convert parameter 1 from 'const char [4]' to 'const wchar_t *'
with
[
BaseType=wchar_t,
StringTraits=StrTraitMFC
]
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or
function-style cast
有没有toString()
像我们在 Java 中使用的那样的函数?