如下:
//由LPSTR到LPWSTR
LPWSTR C2LW(const char* a) {
WCHAR* output = new wchar_t[7900];
swprintf(output, L"%S", a);
return output;
}
//由LPWSTR到LPSTR
char* W2C(const wchar_t* a) {
char* output = new char[7900];
sprintf(output, "%ws", a);
return output;
}