unsigned char转QByteArray
时间: 2023-09-29 11:02:25 浏览: 204
unsigned char数组转成string 用16进制表示
要将unsigned char转换为QByteArray,可以使用QByteArray的构造函数来完成。给定unsigned char数组和数组长度,可以通过将unsigned char数组转换为char数组,然后使用QByteArray(char*, int)构造函数,将其转换为QByteArray对象。例如,对于给定的unsigned char数组decrypt和长度result,可以使用以下代码将其转换为QByteArray对象:
QByteArray retArray((char*)decrypt, result);
这将创建一个QByteArray对象retArray,该对象的内容与unsigned char数组decrypt相对应。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* *3* [Qt笔记-char[]或unsigned char[]转QByteArray时要注意的地方](https://blog.csdn.net/qq78442761/article/details/125701902)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 100%"]
[ .reference_list ]
阅读全文