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.
Qt Code:
  1. QByteArray dataset=new QByteArray();
  2. QDataStream outtopacket =new QDataStream(dataset, QIODevice::WriteOnly);
To copy to clipboard, switch view to plain text mode 

Now if I stream a bit:
Qt Code:
  1. bool mode = false;
  2. *outtopacket<<mode;
To copy to clipboard, switch view to plain text mode 
and then stream a byte
Qt Code:
  1. quint8 data = 15;
  2. *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?