Created
December 4, 2018 21:01
-
-
Save OlivierLDff/e869442c268699d53afdda3809b4004f to your computer and use it in GitHub Desktop.
(C++/Qt) Dump QByteArray as QString
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
QString DumpByteArray(QByteArray& rawData) | |
{ | |
QString res = "{ "; | |
for (int i = 0; i<rawData.size(); ++i) | |
{ | |
res += "0x"; | |
res += QString::number((rawData[i] >> 4) & 0xF, 16); | |
res += QString::number((rawData[i]) & 0xF, 16); | |
if (i != rawData.size() - 1) | |
res += ", "; | |
} | |
res += " }"; | |
return res; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment