std::regex regexpy("y:(.+?)\"");
std::smatch my;
regex_search(value.text, my, regexpy);
y = my[1];
std::wstring wide_string = std::wstring(y.begin(), y.end());
const wchar_t* p_my_string = wide_string.c_str();
wchar_t* my_string = const_cast<wchar_t*>(p_my_string);
URLDownloadToFile(my_string, aDest);
Run Code Online (Sandbox Code Playgroud)
我正在使用Unicode,源字符串的编码是ASCII, UrlDownloadToFile扩展到UrlDownloadToFileW (wchar_t*)上面的代码在调试模式下编译,但有很多警告,如:
warning C4244: 'argument': conversion from 'wchar_t' to 'const _Elem', possible loss of data
Run Code Online (Sandbox Code Playgroud)
那么我想问一下,如何将 a 转换std::string为 a wchar_t?