Skip to content

Instantly share code, notes, and snippets.

@ynonp
Created December 25, 2011 18:43
Show Gist options
  • Save ynonp/1519597 to your computer and use it in GitHub Desktop.
Save ynonp/1519597 to your computer and use it in GitHub Desktop.
#include <QtCore/QtCore>
#include <QtCore/QCoreApplication>
#include <QtCore/QByteArray>
#include <QtCore/QDebug>
#include <QtCore/QLatin1Char>
int main(int argc, char **argv)
{
QCoreApplication app(argc, argv);
static const char mydata[] = {
0xc7, 0xcc, 0x3e, 0x0b, 0x00
};
QByteArray arr = QByteArray::fromRawData(mydata, sizeof(mydata));
qDebug() << arr.toHex();
qDebug() << QString("0x%1").arg(arr.at(0), 2, 16, QLatin1Char('0'));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment