contineously writing to text file and deleting old data after fixed timer

63 Views Asked by At

In Qt I'm writing continuously to text file, so my file size increasing but i want kept size limit so need to delete old data in text file.

I calculating file size in MB for every minute if file size is greater than 600MB I used QFile::resize(100); now file size is 100MB but data is older only , I wanted after resize data should be latest written to file.

1

There are 1 best solutions below

0
On

Operating systems do not support cutting a file at the beginning. Most common solution for big log files is to close the file, rename it and create a new file.