How to read a C++ class from file into memory
David Finlayson
david.p.finlayson at gmail.com
Thu Mar 22 11:12:48 PDT 2007
I am coming from Python to D, so forgive my limited C/C++ knowledge.
What is the idiomatic way to read a heterogeneous binary structure in D?
In my C++ book, it shows examples of defining a class or struct with the appropriate types and then passing a pointer to this class to fread().
However, in Java or Python I could just read the types directly from a binary stream (including the padding bytes associated with the structure on disk).
How should I do this in D?
I did see this post:
http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D.learn&article_id=6071
Note that I ultimately want to store these data back into classes where I can work with it.
Thanks,
David
More information about the Digitalmars-d-learn
mailing list