星期三, 10月 18, 2006

Convert char* to LPCWSTR

example 1:
char a[] = "aaa";
WCHAR wsz[64];
swprintf(wsz, L"%S", a);
LPCWSTR p = wsz;

example 2:
char aaaa[20]="aaa";
LPCWSTR ppp=(WCHAR *)aaaa;


1 則留言:

匿名 提到...

example 2的buffer裡面還是用ascii存
example 1才有把ascii轉成wide char(2 bytes for 1 character)