   Interface for Saving States in a Game Development Library
  I am working on a library that contains simple classes used commonly in game development, and I need to support the saving of states for various objects and systems within it.  Needless to say, I want an interface that will easily integrate with existing code.  My plan was to just have objects write/read to/from an std::ostream or std::istream object.  Would you, as game developers and prospective clients**, consider that an acceptable solution?Would any of you be disappointed that you had to use a standard library stream class to load/save objects?  Would it be easier to integrate into existing code if I used some other method, such as writing directly to a byte array?Thanks for taking the time to read this.  Any help/information will be appreciated.** This library will be free
  Yes, I would consider that a good solutionSeems like a nice idea you're working on :)Regards,/Omid   ;Quote:Original post by Omid GhavamiYes, I would consider that a good solutionCool, thanks for your input.Quote:Seems like a nice idea you're working on :)Thanks!   ;  I've implemented the same method for handling I/O for a few projects in my data structures and algorithms class.  I have plans on using that in a game engine.  When I did this, I found it usefull to create a function object that could handle saving and loading strings to these streams to ensure consistency and avoid errors.  Then made a template for saving and loading the contents of an STL container using a forward iterator to enforce a consistent method for handling that situation as well.  I also made a template to replace the fstream.write and fstream.read methods with a slightly more type safe method (the type is enforced before it is passed to the read or write method).  I did that mostly because forgetting the & symbol will not cause compile errors but it did cause run time errors.