1
votes

when I convert the int to CString, the source code is showed as following

int count = 0;
CString msg;
msg.Format("%d", count); // error

error messsage is

IntelliSense: no instance of overloaded function
"ATL::CStringT::Format [with
BaseType=wchar_t, StringTraits=StrTraitMFC_DLL ATL::ChTraitsCRT>]" matches the argument list
argument types are: (const char [4]) object type is:
CString

How do I solve this problem?

1

1 Answers

2
votes

Enclose "%d" in _T()

msg.Format(_T("%d"), count);