TheIndependentAquarius
18th March 2016, 11:22
int dd = 0xA5;
QByteArray p;
p.push_back (0xA5);
qDebug () << "SOP: " << (int)p[0];
This results in -91 whereas 0xA5 stands for 165 in decimal.
How to store hex in QBytearray, extract it and convert it to decimal?
Added after 11 minutes:
This helped: http://www.qtcentre.org/threads/29598-Extracting-int-values-from-QByteArray?p=139019#post139019
Also, I could have casted it to unsigned char.
QByteArray p;
p.push_back (0xA5);
qDebug () << "SOP: " << (int)p[0];
This results in -91 whereas 0xA5 stands for 165 in decimal.
How to store hex in QBytearray, extract it and convert it to decimal?
Added after 11 minutes:
This helped: http://www.qtcentre.org/threads/29598-Extracting-int-values-from-QByteArray?p=139019#post139019
Also, I could have casted it to unsigned char.