title: read/write raw data with QDataStream
body: <p>I am fairly new to QDataStream and Socket programming, and what I want to do is to simply send a quint32 header value (four bytes) from client to host. But I am having some trouble with QDataStream.</p>
  
  <pre><code>QByteArray data;
  QDataStream ds(&amp;data, QIODevice::ReadWrite);
  int a = htonl(32);
  char *head = (char*)&amp;a;
  for(int i=0;i&lt;4;i++)
      qDebug() &lt;&lt; QString::number(int((head[i]&amp;0xff))+0x100, 16) &lt;&lt; " ";
  qDebug() &lt;&lt; endl;
  </code></pre>
  
  <p>here, the output is "100 100 100 120", which is what I want.
  Then I try to write it into data stream.</p>
  
  <pre><code>ds.writeRawData(head, 4);
  char *buffer = new char[4];
  ds.readRawData(buffer, 4);
  for(int i=0;i&lt;4;i++)
      qDebug() &lt;&lt; QString::number(int((buffer[i]&amp;0xff))+0x100, 16) &lt;&lt; " ";
  qDebug() &lt;&lt; endl;
  </code></pre>
  
  <p>But here the output here is "100 100 100 100"</p>
  
  <p>Am I having some misunderstanding about the usage of QDataStream? </p>