I have my own class defined. It contains some primatives, but also a couple of methods and some arrays of DynamicArrays (e.g., DynamicArray<AnsiString>[10]).
I populate this class at startup from an ini file (a large ini file) via TIniFile. Once populated, I want to be able to store the class, intact, to disk. This way, the next time I startup, I can simply read the stored class and not have to parse the enormous ini file (it takes a long time). I know that the ini file was a poor choice for this, but I'm stuck with it and I somewhat regret it now.
I've experimented a little, but with no success. I've tried:
1) Using TStream (or similar, code not in front of me), but the length of bytes to write is required. I do a sizeof and get only 10 or some small number (I guess the size of the primatives and pointers in my class).
2) I extended the TObject class, which gave me more methods, one of them ->InstanceSize, but that return only 60 (I know the size to at least 200,000).
How do I wrate a class to disk and restore it at a later time?
Thanks in advance.
I populate this class at startup from an ini file (a large ini file) via TIniFile. Once populated, I want to be able to store the class, intact, to disk. This way, the next time I startup, I can simply read the stored class and not have to parse the enormous ini file (it takes a long time). I know that the ini file was a poor choice for this, but I'm stuck with it and I somewhat regret it now.
I've experimented a little, but with no success. I've tried:
1) Using TStream (or similar, code not in front of me), but the length of bytes to write is required. I do a sizeof and get only 10 or some small number (I guess the size of the primatives and pointers in my class).
2) I extended the TObject class, which gave me more methods, one of them ->InstanceSize, but that return only 60 (I know the size to at least 200,000).
How do I wrate a class to disk and restore it at a later time?
Thanks in advance.