Good way for append some string to every line of exists text file
-
[quote author="Vass" date="1316073685"]I don't want keep all data from file in memory, it's not needed
I'm worry about integrity data structure in file.
So I think I will create temp file for inserting and after insert just change temp file to persistent.[/quote]That's the way I would go. Maybe add some file locking, so that nobody can change the source file while you are processing it.
-
@Vaas: despite of the number of columns periodically updated, the number of rows in your file is fixed? How many records ?
-
[quote author="Alicemirror" date="1316275922"] the number of rows in your file is fixed?[/quote]
of course, not.[quote author="Volker" date="1316213165"]
That's the way I would go. Maybe add some file locking, so that nobody can change the source file while you are processing it.
[/quote]I solved it with temp file, just doing copy of current file, changes it, and rewrite original.
I'm not worry about external changes. I'm worry about integrity data structure after immediately power off, for example. -
@Vass: the solution of temp maybe good, I have adopted a similar in a application where I need to download a file and ony when the file is correctly stored on the (tmp folder) device then I can decide if the older file should be delete and substituted by the newly loaded.
Despite of this, what I mean is the following:
having a set of csv records (rows) where you periodically should add a new value (field -> excel colum) to all the records is it possible that the best approach is to inver rows and columns? It the element growing is the number of columns this will be the number of samples. Obviously it is only an intuituion because I don't know the data nature of your samples.
-
@Alicemirror Unfortunately, rows count not fixed, and changes more often than column count.
-
@Vass: you have created a monster! :)
-
Interesting ...
I have done somthing time ago and it was really helpful the solutions adopted by the wget command (Linux) -
Yes I had understood :)
Probably there are not best ways to manage these data. Regarding the proposal of a SQLite database on the device, did you checked if this component has some kind of protection on the transictions to give you the robustness that you need against data loss ?
-
Me too I'm fighting with customer in these days. They have always great ideas :) Seems very experts in mobile development...