|
Boost Users : |
From: Robert Ramey (ramey_at_[hidden])
Date: 2004-12-08 12:06:09
Possible Serialization demo.cpp issue.Its my custom to use scoping for
automatic closing of streams and archives. With this, your example would
look more like:
int _tmain(int argc, _TCHAR* argv[])
{
std::string filename(boost::archive::tmpdir());
filename += "/demofile.txt";
std::string b1("mike");
{
std::ofstream ofs(filename.c_str());
boost::archive::text_oarchive oa(ofs);
oa << b1;
} // stream flushed and closed here. Then archive closed
}
This is the way its done in demo.cpp (by calling save/load in functions).
Robert Ramey
"Holmes, Michael A (Mike)" <mikeholmes_at_[hidden]> wrote in message
news:A58A470FA97DB74A9CC7687166D577E60BC3FE_at_pauex2ku08.agere.com...
I don't know is this is a bug as such, but thought I should bring it up.
I boiled down an un handled exception I was receiving in VC 7.1 and related
it to the demo.cpp
The demo does not close or flush the ofstream before it reads back from the
same file it wrote to, this appears to work correctly for the demo, but in
the attached very simple case it does not. I am assuming that it is because
the ofstream did not get flushed and the file contains no data.
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