本文介绍了将“const wchar_t *”转换为“unsigned char *”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在C ++中可以将const wchar_t *转换为unsigned char *?
In C++ is it possible to convert a 'const wchar_t *' to 'unsigned char *'?
我如何做?
wstring dirName; unsigned char* dirNameA = (unsigned char*)dirName.c_str(); // I am creating a hash from a string hmac_sha256_init( hash, (unsigned char*)dirName.c_str(), (dirName.length)+1 );推荐答案
由于您使用的是WinAPI, =msdn.microsoft/en-us/library/windows/desktop/dd374130%28v=vs.85%29.aspx =nofollow> WideCharToMultiByte 。
Since you're using WinAPI, use WideCharToMultiByte.
更多推荐
将“const wchar
发布评论