Search code examples
mfccstring

cannot convert parameter 1 from 'const char [6]' to 'const wchar_t *


I'm new to MFC and I don't know what to do with this error.

ERROR

error C2664: 'void ATL::CStringT::Format(const wchar_t *,...)' : cannot convert parameter 1 from 'const char [6]' to 'const wchar_t *'

heres the line:

m_Echo1.Format("%d %",state.dwMemoryLoad);

Solution

  • By default a Windows app is set to use 16-bit characters, not 8-bit characters. Change your quoted string to L"%d %" to specify a string of 16-bit characters.