Hello, I have one question about reading binary files.
I wrote data like this:
QVector<QPoint> p;
out << p;
QVector<QPoint> p;
QFile binfile(path);
binfile.open(QIODevice::WriteOnly);
QDataStream out(&binfile);
out << p;
To copy to clipboard, switch view to plain text mode
..and tried reading it this way:
QVector<qint32> x, y;
in >> x >>y;
QFile bin(fileName);
bin.open(QIODevice::ReadOnly);
QDataStream in(&bin);
QVector<qint32> x, y;
in >> x >>y;
To copy to clipboard, switch view to plain text mode
I know this isn't the right way to read this kind of data,
so can anyone help me to put binary data into two vectors, x and y.
Data is written into binary file as a list of points: x1 y1 x2 y2 x3 y3..
..and i should read first all x coordinates to x vector and all y coordinates to y vector..
Bookmarks