Dear rooters,
I would like to write a TObjArray in a file. The TObjArray is filled in a loop where every time the object I would like to store is created with a new. Since I set the array as the owner of its objects, calling the Clear method at the end would delete all the objects I have used to fill the array. This is the only way I have found to make everything work creating a new object in every iteration in the loop (where I CAN NOT delete them, otherwise the array is not writable!). If I don't do like this (i.e. don't call "new" at every iteration), but I just change the members of the object, all the objects at the end would be the same, and precisely, the same as the last object I have created.
Calling "new" every time would be fine, if the number of objects I would like to store was not huge, as, on the contrary, it is in my case, which becomes memory consuming....
What would be the best way to proceed, then? In the attached file you find an example (very simple), hopefully explaining the problem.
Thanks in advance.
Cheers,
Chiara
This archive was generated by hypermail 2.2.0 : Wed Jun 20 2007 - 11:50:02 CEST