I have a binary file. I need to read it and get a QString in human readable format.
I do like this.
{
qDebug() << ba;
}
QFile * file = new QFile("file1.bin");
if(file->open(QIODevice::ReadOnly | QIODevice::Text))
{
QByteArray ba = file->readAll();
qDebug() << ba;
}
To copy to clipboard, switch view to plain text mode
qDebug gives me
"Z\x04\xFF?7\xC8\x10\x00\x00\x00\x00\x00?\x00\x00\ x00\x00\x00\x00\x00 9K86AT25Y6GV\x03\x00\x00@\x00\x00""00000081UFIJST UJM2A23B0 H2G \x10\x80\x00\x00\x00/\x00@\x00\x02\x00\x02\x07\x00\xFF?\x10\x00?\x00\x1 0\xFC\xFB\x00\x10\x01\xFF\xFF\xFF\x0F\x00\x00\x07\ x00\x03\x00x\x00x\x00x\x00x\x00\x00\x00\x00\x00\x0 0\x00\x00\x00\x00\x00\x00\x00\x1F\x00\x06\x17\x00\ x00L\x00@\x00\xF8\x01""B\x00k4\t\x7F""cai0\t\xBE"" ca? \xA0\x00\x00\x00\x80@\xFE\xFF\x00\x00\xFE\xFE\x00\ x00\x00\x00\x00\x00\x00\x00\x00\x00\xB0\xEA""B%\x0 0\x00\x00\x00\x00\x00\x00\x00\x00@\x00\x00\x00P\xE 0\x00\x88""D\xED\xD7\x00\x00\x00\x00\x00\x00\x00\x 00\x00\x00\x00\x00\x00\x00\x1D@\x1C@\x00\x00\x00\x 00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00 \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x 00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00 \x00\x00\x00\x00\x00\x8A\x00\x00\x00\x00\x00\x00\x 04@\x00@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x 00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00 \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x 00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00 \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x 00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00 \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x 00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00 \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x 00\x00=\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0 0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ x00\x00\x00\x00\x00\x00\x00\x00\x1F\x10\x00\x00\x0 0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\f\x00\x00\ x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0 0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xA5""A "
What is this encoding and how can I translate it to readable QString
Bookmarks