[Qt-interest] how to output a user defined struct data to datastream?
Samuel Gaist
samuel.gaist at edeltech.ch
Wed Oct 12 14:09:58 CEST 2011
Hi,
You need to write QDataStream operators for your struct
This might be a starting point
http://doc.qt.nokia.com/4.7/qdatastream.html#reading-and-writing-other-qt-classes
Hope it helps
Samuel
On 12 oct. 2011, at 14:00, Vincent Cai wrote:
> Dear all,
>
> How to output a user defined struct data to datastream?
> Below code can’t pass compiling:
>
> typedef struct
> {
> quint16 header;
> quint8 length;
> quint8 counter;
> quint8 reserved[4];
> } TSA_FRAME_HEADER_STURCT;
>
> TSA_FRAME_HEADER_STURCT headerInfo;
>
> void TSAFrameHeader::writeHeaderString(QFile *file)
> {
> QDataStream out(file);
> out << headerInfo;
> }
>
> Thanks,
> Vincent.
>
> 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
More information about the Qt-interest-old
mailing list