QByteArray arr1 = QByteArray::fromHex("000000A1000000B2000005DC00000000000000900000000000000000000000000000000100000020000000210000000100000000001748C8000000000000046C00000000000000A100000000000000000000006000000000000061E400000000"); for (int i = 0; i < arr1.size(); i += 4) { // 提取四个字节并组合成一个整数(对于原问题,应改为两个字节) quint32 num = (quint8)arr1[i] << 24 | (quint8)arr1[i + 1] << 16 | (quint8)arr1[i + 2] << 8 | (quint8)arr1[i + 3]; // 由于原问题中每两个字节表示一个数字,所以应改为: // quint16 num = (quint8)arr1[i] << 8 | (quint8)arr1[i + 1]; // 解析出的数字 qDebug() << num; }
161 178 1500 0 144 0 0 0 1 32 33 1 0 1525960 0 1132 0 161 0 0 96 0 25060 0
########################
标签:十六进制,QByteArray,Qt,arr1,解析,161,字节 From: https://www.cnblogs.com/herd/p/18435242