title: Using Qdatastream read data from socket and write into file
body: <p>I need to receive binary data(reading float) through a QTcpSocket and write them into Qfile using QDatastream. But I am having some problems with QDataStream. As follows, I can only achieve it using this way ：</p>
  
  <pre><code>QDataStream in(socket);
  in.setFloatingPointPrecision ( QDataStream::SinglePrecision);
  float data;
  in &gt;&gt; data;
  
  QFile file("file.dat"); 
  file.open(QIODevice::WriteOnly); 
  QDataStream out(&amp;file);
  out &lt;&lt; data;
  </code></pre>
  
  <p>I have to create two Qdatastream and write float into Qfile after reading it.I mean, can I read stream and write it into file directly by one Qdatastream in order to getting more efficient.</p>
  
  <p>Am I having some blind spot about the usage of QDataStream?Anyone can help me to solved my problem？Many thanks.</p>