Writing Classes to File
Brad Anderson
brad at dsource.org
Mon May 8 11:46:51 PDT 2006
Jeremy wrote:
> Is there a way I can just write a whole class to a file?
>
> For example, why can't I do:
>
> file.writeExact(someClass, someClass.sizeof);
>
> This seems to just write 4 bytes, which must be the pointer.
>
> The compiler complains when I do this:
>
> file.writeExact(*someClass, (*someClass).sizeof);
>
> Saying that '*' is only used infront of pointers -- but aren't class always
> represented with pointers?
>
> Anyway, I want to save a class to file, so I can load it back. I was hoping
> there was a way to do this without having to write/read each element of the
> class seperately.
>
>
Would Mango's pickling mechanism work here?
http://www.dsource.org/projects/mango
http://mango.dsource.org
BA
More information about the Digitalmars-d
mailing list