|
Boost Users : |
From: Robert Ramey (ramey_at_[hidden])
Date: 2005-10-21 20:45:05
Sam Contapay wrote:
> Now here is my save and load
>
> save:
> // Save the bayes filter especially the map for later use
> std::ofstream ofs("BayesFilter.stb");
> boost::archive::text_oarchive
> outarchive(ofs);
> outarchive << this; ofs.close();
>
> load:
>
> std::ifstream ifs("BayesFilter.stb");
> boost::archive::text_iarchive ia(ifs);
> CObjTest test;
> ia >> test;
> ifs.close();
>
There is a aproblem here. You're saving a pointer (this)
and loading and object.
You should have something like:
// Save the bayes filter especially the map for later use
CObjTest test;
....
std::ofstream ofs("BayesFilter.stb");
boost::archive::text_oarchive outarchive(ofs);
outarchive << test;
> load:
std::ifstream ifs("BayesFilter.stb");
boost::archive::text_iarchive ia(ifs);
CObjTest test;
ia >> test;
That should do it.
Robert Ramey
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net