QFile file(s); file.open(QIODevice::ReadOnly); QDataStream in(&file); // read the data serialized from the file qint32 objectCount; in >> objectCount; for (qint32 i = 0; i < objectCount; ++i) { qint32 pntX; qint32 pntY; in >> pntX; in >> pntY; }