Skip to content

Instantly share code, notes, and snippets.

@HamedMasafi
Created December 11, 2019 09:24
Show Gist options
  • Save HamedMasafi/f83863e0fa7e63ff3e5e179ef2ad6e76 to your computer and use it in GitHub Desktop.
Save HamedMasafi/f83863e0fa7e63ff3e5e179ef2ad6e76 to your computer and use it in GitHub Desktop.
read snss
#include "mainwindow.h"
#include <QtWidgets/QApplication>
#include <QFile>
#include <QDebug>
struct FileHeader {
qint32 signature;
qint32 version;
};
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QFile f("/home/hamed/.config/google-chrome/Default/Current Tabs");
if (f.open(QIODevice::ReadOnly)) {
FileHeader header;
f.read(reinterpret_cast<char*>(&header),
sizeof(header));
qDebug() << header.signature << header.version << (header.signature == 0x53534E53);
while (!f.atEnd()) {
quint16 size;
quint8 id;
f.read(reinterpret_cast<char *>(&size), 2);
f.read(reinterpret_cast<char *>(&id), 1);
auto data = f.read(size);
qDebug() << "#" <<id << "=" <<size;
}
f.close();
} else {
qDebug() << "unable to open file";
}
// return a.exec();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment