On terça-feira, 8 de março de 2016 21:27:52 PST Nikita Krupenko wrote: > 2016-03-08 19:30 GMT+02:00 Thiago Macieira <thiago.macie...@intel.com>: > > Indeed, but look at how you've combined two or more examples. You have a > > byte array, you create a QDataStream on it, write some data, then you > > used QDataStream to write that byte array to another byte array. You > > probably didn't want that. > > It could be useful, if I want to write checksum of the data to the > file. To do this, I can write > some data to the QByteArray wrapped in QDataStream, then calculate > checksum using > qChecksum() (or QCriptographicHash) and then write byte array and > checksum to the file.
You could do that, but this is not what I was talking about. The problem was that Sina caused redundancy in the data: <32-bit value N+4> <32-bit value N/2> <string of length N/2> Do you see the redundancy? In your case, just make sure you don't use QDataStream to write the bytearray that was check-summed, or you'll do the same as the above. -- Thiago Macieira - thiago.macieira (AT) intel.com Software Architect - Intel Open Source Technology Center _______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest