C ++样式从unsigned char *转换为const char * [英] C++ style cast from unsigned char * to const char *
本文介绍了C ++样式从unsigned char *转换为const char *的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有:
unsigned char *foo();
std::string str;
str.append(static_cast<const char*>(foo()));
错误:无效static_cast从类型'unsigned char *'到type' const char *'
在C ++风格中正确的方式是什么?
What's the correct way to cast here in C++ style?
推荐答案
reinterpret_cast
reinterpret_cast
这篇关于C ++样式从unsigned char *转换为const char *的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文