开发者

How am I using CA2W incorrectly?

Please could someone explain why this does not work?

c开发者_StackOverflowhar *test = "test";
_TCHAR *szTest = CA2W(test);

And please tell me what I should be doing instead.

Instead of giving me equal text, it's giving me:

﻾﻾﻾﻾﻾﻾﻾﻾﻾﻾﻾﻾﻾﻾﻾﻾﻾﻾﻾﻾﻾﻾﻾﻾﻾﻾﻾﻾﻾﻾﻾﻾


According to MSDN, that is bad. So I have used this instead:

char *test = "test";
CA2W szTest(test);

From here, we can get an LPWSTR type if we really want:

LPWSTR test = szTest.m_psz;

It also seems better to use LPWSTR instead of _TCHAR * - but I'm not sure (I think they're essentially the same thing, but could be wrong).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜