[Qt-interest] how to output a user defined struct data to datastream?
Vincent Cai
wcai at cypress.com
Fri Oct 14 10:57:59 CEST 2011
Hi,
So in the way, if I want to output an big array: quint16 dataArray[1000][1000] to datastream,
I have to output the dataArray items one by one with a for loop?
If yes, then the efficiency will be very poor, right?
-----Original Message-----
From: qt-interest-bounces+wcai=cypress.com at qt.nokia.com [mailto:qt-interest-bounces+wcai=cypress.com at qt.nokia.com] On Behalf Of Vincent Cai
Sent: 2011年10月13日 17:09
To: Andre Haupt
Cc: Qt-interest
Subject: Re: [Qt-interest] how to output a user defined struct data to datastream?
You are right, thanks so much!
-----Original Message-----
From: Andre Haupt [mailto:andre at bitwigglers.org]
Sent: 2011年10月13日 17:05
To: Vincent Cai
Cc: Andre Haupt; Samuel Gaist; Qt-interest
Subject: Re: [Qt-interest] how to output a user defined struct data to datastream?
On Thu, Oct 13, 2011 at 04:49:27AM -0400, Vincent Cai wrote:
> Sorry, but I think the endian is controlled by QDataStream which is platform independent, am I wrong?
This is correct, as long as you use it the right way ;-)
You had a 16 bit member in your struct, but in your sample you passed
that member bytewise to QDataStream.
So writing to the stream on a little endian platform and then reading on
big endian would have swapped the bytes of your 16 bit member.
regards,
Andre
This message and any attachments may contain Cypress (or its subsidiaries) confidential information. If it has been received in error, please advise the sender and immediately delete this message.
_______________________________________________
Qt-interest mailing list
Qt-interest at qt.nokia.com
http://lists.qt.nokia.com/mailman/listinfo/qt-interest
This message and any attachments may contain Cypress (or its subsidiaries) confidential information. If it has been received in error, please advise the sender and immediately delete this message.
More information about the Qt-interest-old
mailing list