> > QByteArray bai; > > out2 << bai.size(); > > out2 << bai; > Here you wrote out an int and a QByteArray, so the file contains 4 bytes > for the int "bai.size()" (value of 22), and then because of how QDataStream > serializes QByteArrays, another 4 bytes for the size of the QByteArray > (still a value of 22), plus the contents of the QByteArray itself. At this > point, remember that the contents of the QByteArray are 4 bytes for the > size of the QString (value of 18) plus the QString in UTF-16 format.
Sean, Thank you for explaining how QDataStream works actually. Since I got more instinct about the subject, I can see how I made my mistake and some unnecessary approach. For example reading differently then writing out. And writing out the bytearray size :S. Cheers, Sina
_______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest