title: Qt cpp - Clean way to write QString into text file
body: <p>I need to find a clean and fast way to write a <code>QString</code> in <code>.csv</code> file.
  I tried:</p>
  
  <pre><code>QString path= QCoreApplication::applicationDirPath() + QString("/myfile.csv");
  QFile file(path);
  QString mystring = "Hello, world!";    
  if(!file.open(QIODevice::WriteOnly)){
          file.close();
      } else {
          QTextStream out(&amp;file); out &lt;&lt; mystring;
          file.close();
      }
  </code></pre>
  
  <p>But it writes for me <code>"???????"</code> in <code>myfile.csv</code></p>