将string 转化为 LPCWSTR:
string strText = "你好";
size_t size = string.length();
wchar_t *buffer = new wchar_t[size+1];
MultiByteToWideChar( CP_ACP, 0, strText.c_str(), size, buffer, size * sizeof(wchar_t) );
buffer[size] = 0; // 确保以 '\0' 结尾
现在buffer就是就包含里的你的转化后的 LPCSTR 了
不要忘记使用完后
delete buffer;
MultiByteToWideChar 具体用法请参见 MSDN
string strText = "你好";
size_t size = string.length();
wchar_t *buffer = new wchar_t[size+1];
MultiByteToWideChar( CP_ACP, 0, strText.c_str(), size, buffer, size * sizeof(wchar_t) );
buffer[size] = 0; // 确保以 '\0' 结尾
现在buffer就是就包含里的你的转化后的 LPCSTR 了
不要忘记使用完后
delete buffer;
MultiByteToWideChar 具体用法请参见 MSDN