将“const wchar

编程入门 行业动态 更新时间:2024-10-24 00:29:55
本文介绍了将“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

本文发布于:2023-10-07 14:33:05,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1469641.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:const   wchar

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!