Please, consider the following code fragment from the QDataStream
documentation:
QFile file("file.dat");
file.open(QIODevice::ReadOnly);
QDataStream in(&file); // read the data serialized from the file
QString str;
qint32 a;
in >> str >> a; // extract "the answer is" and 42
Is there a way to know that QDataStream
cannot deserialize the content of the file to QString
and qint32
and how to handle such deserialization errors in QDatastream
?