Hi,

I have tried the xml examples and they work just fine.

I figured out the problem in my program. Its a silly mistake. In the main() function, the ofstream creates the file "filename" and we save in the first attempt. In the second session, the ofstream again creates the file "filename" and it will overwrite the previous saved one and will be empty. so when I tried to load, it threw an Archive exception. I kept the 
std::ofstream ofs("filename"); 
in the case '1': block and it worked fine.

As this problem is solved, how do we close this post?

Thanks Robert.



On Wed, Jan 12, 2011 at 10:13 PM, Robert Ramey <ramey@rrsd.com> wrote:
Tejaswin Macharla wrote:
> Hi,
>
>
> I have changed the sample code given in the Boost site for
> Serialization and the saving of the file works fine.
> The code works fine without the switch case as it executes save and
> load in the same session. I can save and load in the same session.
> If I close the application and open the application again and try to
> load the saved(serialized) file, it is throwing an Archive Exception.
>
>
> I am trying this for a game that I am working on so as to save and
> load in different sessions.
>
>
This look OK to me.

There is a pair of examples in the package. demo_save and demo_load.
(also demo_xml_save and demo_xml_load).  Try these examples.  If
they work - compare them to your own test.  If they don't work, let me know.

Robert Ramey



_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users



--
Regards
------------------------------
Tejaswin G Macharla
-----------------------------