How to remove a line from a file?
{
while(!out.atEnd()){
line = out.readLine();
linesimp = line.simplified();
for (int i = 0; i < l.size(); ++i)
if (linesimp.
contains(QString("S%1 %2").
arg(l.
at(i
)).
arg(p.
at(i
)))){ line.clear();
}
out << line << endl;
}
}
file.close();
}
void DeslocaPt::skip(QStringList &l, QStringList &p)
{
QString arqAlt = altEdit->text();
QString line, linesimp;
QFile file(arqAlt);
if(file.open(QIODevice::ReadWrite | QIODevice::Text)){
QTextStream out(&file);
while(!out.atEnd()){
line = out.readLine();
linesimp = line.simplified();
for (int i = 0; i < l.size(); ++i)
if (linesimp.contains(QString("S%1 %2").arg(l.at(i)).arg(p.at(i)))){
line.clear();
}
out << line << endl;
}
}
file.close();
}
To copy to clipboard, switch view to plain text mode
I tried to do:
line.clear();
out << line << endl;
line.clear();
out << line << endl;
To copy to clipboard, switch view to plain text mode
I used this command to position
out.seek(out.pos() - line.size() );
out.seek(out.pos() - line.size() );
To copy to clipboard, switch view to plain text mode
result is not satisfactory. Any idea?
Bookmarks