1 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
5 // (C) Copyright 2002-4 Robert Ramey - http://www.rrsd.com .
6 // Use, modification and distribution is subject to the Boost Software
7 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
8 // http://www.boost.org/LICENSE_1_0.txt)
12 #include <boost/archive/tmpdir.hpp>
14 #include <boost/archive/xml_iarchive.hpp>
16 #include "demo_gps.hpp"
19 restore_schedule(bus_schedule
&s
, const char * filename
)
22 std::ifstream
ifs(filename
);
24 boost::archive::xml_iarchive
ia(ifs
);
26 // restore the schedule from the archive
27 ia
>> BOOST_SERIALIZATION_NVP(s
);
30 int main(int argc
, char *argv
[])
32 // make a new schedule
33 bus_schedule new_schedule
;
35 std::string
filename(boost::archive::tmpdir());
36 filename
+= "/demo_save.xml";
38 restore_schedule(new_schedule
, filename
.c_str());
41 std::cout
<< "\nrestored schedule";
42 std::cout
<< new_schedule
;