[SOLVED] How can I override a text line in txt file.
General and Desktop
13
Posts
3
Posters
5.0k
Views
1
Watching
-
Hi,
One question first: is that the only content of your file ?
-
Then you should just read the file line by line in e.g. a QStringList. Replace the line you modified in the QStringList and then overwrite the content of the original file with the content of the QStringList.
-
Of reading a file line by line ?
-
Then please, take some time to read the documentation of this class.
One way:
@QStringList lines
//open file etc.
while(!steam.atEnd()) {
lines << stram.readLine();
} @There are also other way to do that e.g. using QString::split
-
With that you don't just change one line like you ask for, you are overwriting everything.