#include #include #include #include int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); QString fileName("fraktle3.gbr"); // ------------------------------------------------ QFile file(fileName); file.open(QIODevice::ReadOnly); quint32 headerSize; quint32 version; quint32 width; quint32 height; quint32 colorDepth; quint32 magic; quint32 spacing; QString brushName; char* data; QDataStream in(&file); in >> headerSize >> version >> width >> height >> colorDepth >> magic >> spacing; file.close(); if ((magic != 0x47494D50)) { qDebug() << "No GBR file!" << endl; file.close(); exit(1); } if (version != 2) { qDebug() << "Unknown GBR version!" << endl; file.close(); exit(1); } // read the brush name unsigned int nameLength = headerSize-28; char* brushName_c = new char[nameLength]; in.readBytes(brushName_c, nameLength); brushName = QString(brushName_c); delete brushName_c; // debugging qDebug() << "headerSize" << headerSize << endl; qDebug() << "version" << version << endl; qDebug() << "width" << width << endl; qDebug() << "height" << height << endl; qDebug() << "colorDepth" << colorDepth << endl; qDebug() << "spacing" << spacing << endl; qDebug() << "brushName" << brushName << endl; return 0; }