Nothing to do with Qt per se. General steps:
- Open original file for reading
- Open temporary file for writing
- Write lines from original file until you reach the line you want to replace
- Write the replacement line
- Skip the line from the original file
- Write lines from original file until end of file
- Close temporary and original file
- If all of above successful, remove original file and copy/rename temporary file.
Start with QFile, QTextStream and QTemporaryFile in the Qt docs. The temporary file could be in-memory; see QBuffer.
Bookmarks