QDatastream read raw data
Unsolved
General and Desktop
-
-
There are two ways:
- Just use << / >> with QByteArray directly:
QByteArray to = ... out << to; QByteArray from; in >> from;
- Or use writerawdata/readrawdata and store the array size, like:
QByteArray to = ... out << qint64(to.size()); out.writerawdata(..., size); QByteArray from; qint64 size = 0; in >> size; in.readrawdata(..., size);
PS: I prefer the first way, if there no any restrictions/requirements for the file format.