juracist
17th May 2012, 17:46
Hello, I have one question about reading binary files.
I wrote data like this:
QVector<QPoint> p;
QFile binfile(path);
binfile.open(QIODevice::WriteOnly);
QDataStream out(&binfile);
out << p;
..and tried reading it this way:
QFile bin(fileName);
bin.open(QIODevice::ReadOnly);
QDataStream in(&bin);
QVector<qint32> x, y;
in >> x >>y;
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..
I wrote data like this:
QVector<QPoint> p;
QFile binfile(path);
binfile.open(QIODevice::WriteOnly);
QDataStream out(&binfile);
out << p;
..and tried reading it this way:
QFile bin(fileName);
bin.open(QIODevice::ReadOnly);
QDataStream in(&bin);
QVector<qint32> x, y;
in >> x >>y;
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..