QFile, writing at a specific line
-
Hi all,
I would like to ask one question.
The problem is, I have a loop which will write to a file. In each loop, I write two parameters for each line, one is the index, and one is the value. If I write line by line like that, my file will be very long and could not open it fully in Excel.
For example:- Loop 1: (1,2342), (2, 3423), (3, 23423)...
- Loop 2: (1, 45645), (2, 34523), (3, 23452)...
...
The problem is, I would like to do like this:
Loop 1, I write line by line until fulfill my index.
Loop 2, I go to the index position, and write the value.
For example:
(1, 2342, 45645...), (2, 3423, 34523...), (3, 23423, 23452...)...
I have searched and could not find any methods to write to the end of a specific line. How could I do this? Some guys said I could do a temp list but my list is unlimited so it could be impossible. I know number of loop but could not know number of values I will write.
I am looking forward for any reply,
Thanks a lot,
Nana, -
I do not think you can do it for a text file,
at least not without re-writing the existing file when you want to add another value. -
Hi,
Are you creating a CSV file ? If so, QxtCsvModel might be an interesting solution.
Hope it helps