unsigned char*转化为string
int main(int argc,char **argv){//unsigned char * 转化为string//参考链接 https://www.itdaan.com/tw/4ff531a5e6651468a5b7c6d95927ba3dunsigned char *foo;unsigned char str[] = "Hello world";string strHH;foo = str;strHH.append(reinterpret_cast<const char*>(foo));cout << strHH << endl;}
输出结果
参考链接
- https://www.itdaan.com/tw/4ff531a5e6651468a5b7c6d95927ba3d 本文只是参考链接提供的其中一种方法,其余的方法还没有测试,如果感兴趣请自行查阅