[Interest] reading from and writing to a file with QDataStream

Sina Dogru sinadooru at gmail.com
Wed Mar 9 08:03:38 CET 2016


>
> The problem is that the section you commented out could have hidden other
> bugs. You didn't show how module A added to the data to be transmitted.
>

I have commented out because the module A just adding some other QVariants
and QString to the bytearray with using QDataStream.  That was my reason I
was
passing data as QByteArray between modules. Because I have seperated them
and
each modules serializes their own data. For example on the module A, I was
constructing a QDataStream with the same QByteArray and insert QVariant and
QString datas.


> That doesn't mean anything.
>

Yes you are right, constructing a QDataStream with a bytearray overwrite
that. So seems
like every module should work on their own bytearray and return copy of it?


> 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.
>

 Well I didn't want that for sure. My intention was collect all modules
datas on a single
byte array (I do not understand myself why I forced to collect them on all
in a same
bytearray). While collecting modules datas on it, I was also be able to
extracts same datas
individually for modules. But I was not realized that I was not extracting
same as I inserted.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20160309/07b0e50b/attachment.html>


More information about the Interest mailing list