March 22, 2007 How to read a C++ class from file into memory | ||||
---|---|---|---|---|
| ||||
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 |
Copyright © 1999-2021 by the D Language Foundation