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
########################