How to remove a line from a file?

Qt Code:
  1. void DeslocaPt::skip(QStringList &l, QStringList &p)
  2. {
  3. QString arqAlt = altEdit->text();
  4. QString line, linesimp;
  5. QFile file(arqAlt);
  6. if(file.open(QIODevice::ReadWrite | QIODevice::Text)){
  7. QTextStream out(&file);
  8. while(!out.atEnd()){
  9. line = out.readLine();
  10. linesimp = line.simplified();
  11. for (int i = 0; i < l.size(); ++i)
  12. if (linesimp.contains(QString("S%1 %2").arg(l.at(i)).arg(p.at(i)))){
  13. line.clear();
  14. }
  15.  
  16. out << line << endl;
  17. }
  18. }
  19. file.close();
  20. }
To copy to clipboard, switch view to plain text mode 

I tried to do:
Qt Code:
  1. line.clear();
  2. out << line << endl;
To copy to clipboard, switch view to plain text mode 
I used this command to position
Qt Code:
  1. out.seek(out.pos() - line.size() );
To copy to clipboard, switch view to plain text mode 
result is not satisfactory. Any idea?