cannot convert parameter 1 from 'CString' to 'const char *'
cannot convert parameter 1 from 'const char [8]' to 'wchar_t'
I get Many errors involving "cannot convert" with different things involving CString, wchar_t or char. I had this working at one point but then i started the project over again and I think I am missing a few libraries.
Does anyone know whats causing these errors or what library/include I need?
C++ Errors?
to correct error 1, cast CT2CA. Example:
CHAR temp[100];
CString tempString = _T("hello world");
sprintf( temp, "%s", CT2CA( tempString) );
OR,
CString tempString = _T("hello world");
CT2CA temp(tempString);
to correct error 2, cast to CString, Example:
CHAR temp[100] = "hello world";
CString tempString;
tempString = CString(temp);
OR,
CString tempString = CString("hello world");
Reply:CString has a cast operator to LPCTSTR which is as good as const char * (unless you are coding for Unicode or something), so I'm not sure what's wrong there. Const char[8] is an array of chars while wchar_t is a single char. What's more, I believe wchar_t is a 16-bit char, so you wouldn't be able to swap between anything made out of char and anything made out of wchar_t. I believe MSDN mentions a function that copies from one to the other, but I don't know what it is called.
Reply:It's not due to missing libraries.
Please post the code in question so that it can be analyzed.
Reply:c# is way less confusing,see if u can use c# instead
online survey
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment