I'm trying to write 1 kb at start of file, file size is 5mb. I'm using QFile object, it truncate file to 1kb. I want to keep rest of file as it is. I only want to change initial 1kb. How can I do this?
I'm trying to write 1 kb at start of file, file size is 5mb. I'm using QFile object, it truncate file to 1kb. I want to keep rest of file as it is. I only want to change initial 1kb. How can I do this?
Open in QIODevice::Append mode and then seek to the beginning of the file before writing.
I know, but you still have to open in append mode, otherwise your file will be truncated. After you open in append, you can seek to the beginning of the file and replace its contents there.
Bookmarks