title: Binary file format vs Text-based format file size
body: <p>I read that saving my files in binary-format was more compact than saving it in a text-based format. But how is it that my binary-format files are larger than the text-based one? </p>
  
  <p>Here are the basics of the functions that I wrote. Both scanned the same directory. The binary-based file is always a few kilobytes larger. </p>
  
  <p>Text-based:</p>
  
  <pre><code>void oldSave(){
      QFile file("sentry.dat");
      QTextStream out(&amp;file);
      file.open(QIODevice::WriteOnly);
      QDir dir = dirSelect;
  
      out &lt;&lt; "Directory: " &lt;&lt; dirSelect &lt;&lt; endl; 
      //prepend directory from which scan was selected to begin from
  
      out &lt;&lt; QCryptographicHash::hash(hashFile.readAll(),
                QCryptographicHash::Md5).toHex()
          &lt;&lt; " : " &lt;&lt; hashFile.fileName() &lt;&lt; "\n";
  </code></pre>
  
  <p>Binary-based:</p>
  
  <pre><code> void saveFile(){
      QFile file("sentry.dat");
      QDataStream out(&amp;file);
      file.open(QIODevice::WriteOnly);
      QDir dir = dirSelect;
  
      out &lt;&lt; dirSelect;
      out &lt;&lt; QCryptographicHash::hash(hashFile.readAll(), QCryptographicHash::Md5) 
          &lt;&lt; hashFile.fileName();
  </code></pre>