Sorry,
int main(int argc, char *argv[])
{
QFile f
("C:\\Program Files (x86)\\TeamViewer\\Version6\\TeamViewer.exe");
....
int size = f.size();
qDebug() << "size: " << size;
char * buffer;
uint u = sizeof(f);
data.readBytes(buffer,u);
f.close();
return a.exec();
}
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
QFile f("C:\\Program Files (x86)\\TeamViewer\\Version6\\TeamViewer.exe");
....
int size = f.size();
qDebug() << "size: " << size;
QDataStream data(&f);
char * buffer;
uint u = sizeof(f);
data.readBytes(buffer,u);
f.close();
return a.exec();
}
To copy to clipboard, switch view to plain text mode
what you're doing??
- You're using a pointer "buffer" as array of bytes (WRONG)
- You're using sizeof of an object as amount of data to read (WRONG)
for 1. it's strange that your program doesn't crash
I suggest you
int size = f.size();
qDebug() << "size: " << size;
int size = f.size();
qDebug() << "size: " << size;
QByteArray buffer = f.read (size);
To copy to clipboard, switch view to plain text mode
and use directly "buffer"
Bookmarks