WCHAR* S2W(char* ansi)
{
int i;
WCHAR* unicode;
unicode = (WCHAR*) malloc ((strlen(ansi)+2)*sizeof(WCHAR));
for (i = 0; i<(signed)strlen(ansi)+1; i++)
unicode[i] = ansi[i];
unicode[i] = 0;
return unicode;
}
记得最后要释放unicode指针。
WCHAR* S2W(char* ansi)
{
int i;
WCHAR* unicode;
unicode = (WCHAR*) malloc ((strlen(ansi)+2)*sizeof(WCHAR));
for (i = 0; i<(signed)strlen(ansi)+1; i++)
unicode[i] = ansi[i];
unicode[i] = 0;
return unicode;
}
记得最后要释放unicode指针。