1,十六进制字符串转整型

msgType = datagram.mid(1,1).toHex().toUShort(Q_NULLPTR,16);

msgType为UInt8,在字符串datagrame中位于第1字节,datagrame为QBytearray。

2,十六进制字符串转double

 quint64 longitude = datagram.mid(12,8).toHex().toULongLong(0,16);
    vehInfo.longitude  = *(double*)&longitude;

longitude在字符串中第12字节,大小为8字节。

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-11-17
  • 2021-08-06
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-17
猜你喜欢
  • 2021-09-27
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-01
相关资源
相似解决方案