How am I misusing CA2W?
Please can someone explain why this is not working?
char *test = "test";
_TCHAR *szTest = CA2W(test);
And please tell me what should I do instead.
Instead of giving me equal text, it gives me:
ο»Ύο»Ύο»Ύο»Ύο»Ύο»Ύο»Ύο»Ύο»Ύο»Ύο»Ύο»Ύο»Ύο»Ύο»Ύο»Ύο»Ύο»Ύο»Ύο»Ύο»Ύο»Ύο»Ύο»Ύο»Ύο»Ύο»Ύο»Ύο»Ύο»Ύο»Ύο»Ύ
+2
source to share
1 answer
According to MSDN, this is bad. So I used this instead:
char *test = "test";
CA2W szTest(test);
From here we can get the LPWSTR type if we really want to:
LPWSTR test = szTest.m_psz;
It's also better to use LPWSTR instead of _TCHAR * - but I'm not sure (I think they are essentially the same thing, but they might be wrong).
+4
source to share