title: Qt - reading from a text file
body: <p>I have a table view with three columns; I have just passed to write into text file using this code</p>
  
  <pre><code>QFile file("/home/hamad/lesson11.txt");
  if(!file.open(QIODevice::WriteOnly)) {
      QMessageBox::information(0,"error",file.errorString());
  }
  QString dd;
  
  for(int row=0; row &lt; model-&gt;rowCount(); row++) {
       dd = model-&gt;item(row,0)-&gt;text() +  ","
                   + model-&gt;item(row,1)-&gt;text() +  ","
                   + model-&gt;item(row,2)-&gt;text();
  
       QTextStream out(&amp;file);
       out &lt;&lt; dd &lt;&lt; endl;
   }
  </code></pre>
  
  <p>But I'm not succeed to read the same file again, I tried this code but I don't know where is the problem in it</p>
  
  <pre><code>QFile file("/home/hamad/lesson11.txt");
  QTextStream in(&amp;file);
  QString line = in.readLine();
  while(!in.atEnd()) {
  
      QStringList  fields = line.split(",");
  
      model-&gt;appendRow(fields);
  
  }
  </code></pre>
  
  <p>Any help please ?</p>