mardi 17 septembre 2019

Warning C4477 'wprintf_s' : format string '%s' requires an argument of type 'wchar_t *'

When I am compiling my C++ project, I am getting the below warning message:

Warning C4477 'wprintf_s' : format string '%s' requires an argument of type 'wchar_t *', but variadic argument 1 has type 'std::basic_string,std::allocator>'

The error is when calling,

wstring(featureList)

Below is the code snippet:

CString featureList;

MyLog(L"featureList1.Replace(restoken + L\"; \", L\"= 1; \") list : %s",wstring(featureList));

When I cast with c_str() like as shown below, then the warning is resolved.

wstring(featureList).c_str()

Can I proceed with this fix?

Aucun commentaire:

Enregistrer un commentaire