Hello,
I want to create a packet of data from a collection of bits and bytes and later store in a binary file.. I am using QDataStream as I figured it is the only way to serialise my data.
QByteArray dataset=new QByteArray();
QDataStream outtopacket =new QDataStream(dataset, QIODevice::WriteOnly);
To copy to clipboard, switch view to plain text mode
Now if I stream a bit:
bool mode = false;
*outtopacket<<mode;
bool mode = false;
*outtopacket<<mode;
To copy to clipboard, switch view to plain text mode
and then stream a byte
quint8 data = 15;
*outtopacket<<data;
quint8 data = 15;
*outtopacket<<data;
To copy to clipboard, switch view to plain text mode
how is it going to deal with the bit? Is it going to pad it with zeros? Will the next data streamed into the packet occupy the next empty bit in QByteArray?
Any better way to serialize my data?
Bookmarks