I have downloaded an sample code, so there are some CString variables in that code which are passed to the sscanf() function as char* the compiler implicitly converts those CString and the code complie fine.the code which works fine is here:
CString m_strVersionXFS;
m_strVersionXFS = _T("00029903");
DWORD nVersion;
sscanf(m_strVersionXFS,"%08X",&nVersion);
the problem is here when i tried to write my own simple code which tries to manipulate a CString variable in the same way but the compiler says which can’t convert a CString to a cahr*
I suspect that your own code is using unicode (
UNICODEconstant defined). This means thatCStringis using wide characters, and will implicitly convert towchar_t*, but not tochar*.If that is the case, there are three possible solutions:
swscanf, the wide character version ofsscanf(recommended);CStringAinstead ofCStringso you’re using the ANSI version ofCString;