title: Qt QFile/QTextStream, unable to parse /proc/stat
body: <p>I'm having a problem parsing <code>/proc/stat</code> with Qt. </p>
  
  <p>The problem I'm having is <code>QFile</code> states <code>/proc/stat</code> is both open <em>and</em> readable. </p>
  
  <p>When attempting to read the lines individually, <code>QTextStream</code> apparently dictates the stream has completed, but I know this isn't the case by running a <code>cat /proc/stat</code>.</p>
  
  <p>None of the code in the <code>while</code> loop is executed. Any advice or suggestions?</p>
  
  <pre><code>  int UsageStatistics::handle_timeout(const ACE_Time_Value&amp; currentTime, const void* param) {
  
          INFO("Handling timeout\n");
  
          QFile file(QString("/proc/stat"));
          if (!file.open(QIODevice::ReadOnly)) {
              ERROR("Unable to open file %s, aborting\n", file.fileName().toStdString().c_str());
              return false;
          }                 
  
          if (!file.isReadable()) {
              ERROR("Unable to read file %s, aborting\n", file.fileName().toStdString().c_str());
              return false;
          }
  
  
  
          QTextStream in(&amp;file);            
          while (!in.atEnd()) {
              QString line = in.readLine();        
  
              INFO("%s\n", line.toStdString().c_str());
  
               /// processing
          }
  
          file.close();
  
          return true;          
      }
  </code></pre>