title: Qt binary reading error in qDatastream
body: <p>I am reading a binary file that is a produced by a sensor. I am having problem in reading float with different precision (32 or 64). I can read them in MATLAB (64 bit version) but Qt (32 bit version on windows) is giving wrong values. I can read till <code>dtmth</code> (please ref structure below) . After it I am getting a value <code>Inf</code> for <code>baseline</code>. This value is <code>0</code> in fact. As you can see, I changed MSB (LittleEndian). If I keep BigEndian, I get <code>0</code> for baseline but others values are wrong then. My desktop is 64 bit.</p>
  
  <p>I have checked number of bytes and they are correct. I think the problem is machine precision. </p>
  
  <pre><code>QDataStream in(&amp;file);
  
             in.setByteOrder(QDataStream::LittleEndian);
             params p;
  
             in &gt;&gt; p.filetype;               
             in &gt;&gt; p.projectid;
             in &gt;&gt; p.datamin;               
             in &gt;&gt; p.dtyear;
             in &gt;&gt; p.dtmth;              
             in &gt;&gt; p.baseline;
             in &gt;&gt; p.startfrequ;
  </code></pre>
  
  <p>Where p is a structure defined as:</p>
  
  <pre><code>    struct params
      {
          quint8 filetype;   
          quint16 projectid;
          double datamin;
          quint16 dtyear;
          quint8 dtmth;    
          float baseline;
          double startfrequ;
  
      };
  </code></pre>
  
  <p>I can read them in MATLAB. My matlab is 64 bit version where I read data types as following:</p>
  
  <pre><code>MATLAB:
          uint8 filetype;   
          uint16 projectid;
          float64 datamin;
          uint16 dtyear;
          uint8 dtmth;    
          float32 baseline;
          float64 startfrequ;
  </code></pre>
  
  <p>Let me know if I missed any details.</p>
  
  <p>EDIT:</p>
  
  <p>Reading file:</p>
  
  <pre><code>    QString fileName = QFileDialog::getOpenFileName(this, tr("Open File"), QString(),
                 tr("Raw Files (*.msr);;All files (*.*)"));
  
             if (!fileName.isEmpty()) {
                 qDebug("Attempting to open file..");
                 QFile file(fileName);
                 if (!file.open(QIODevice::ReadOnly)) {
                     QMessageBox::critical(this, tr("Error"), tr("Could not open file"));
                     return;
                 }
  
                 QDataStream in(&amp;file);
  </code></pre>
  
  <p>Thanks a lot in advance.</p>