Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QByteArray.toUShort does not return the correct result...
phamtv last edited by
I have the following test code:
Buffer = 0x23;
Buffer = 0x12;
uint val = Buffer.toUShort(&ok, 16);
I expected the result for val to be 0x1223 or the decimal equivalent but I get 0. Am I missing something here?
DenisKormalev last edited by
toUShort() method returns ushort from string representation stored in bytearray. So for you example you need to have "0x1223" in your bytearray.