Qt Demo,需要将字符串与byte数组互转,参考:
https://stackoverflow.com/questions/37802575/qt-c-qstring-to-qbytearray-conversion
代码很简单:
1. 字符串转byte数组
QString str = "ABC";
QByteArray bytes = str.toUtf8();
2. byte数组转字符串
QString str = QString::fromUtf8(data);
Qt Demo,需要将字符串与byte数组互转,参考:
https://stackoverflow.com/questions/37802575/qt-c-qstring-to-qbytearray-conversion
代码很简单:
1. 字符串转byte数组
QString str = "ABC";
QByteArray bytes = str.toUtf8();
2. byte数组转字符串
QString str = QString::fromUtf8(data);
>