Boost C++ Libraries of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.


// demo_xml_load.cpp
// (C) Copyright 2002-4 Robert Ramey - .
// Use, modification and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at

#include <iostream>
#include <string>
#include <boost/archive/tmpdir.hpp>

#include <boost/archive/xml_iarchive.hpp>

#include "demo_gps.hpp"

restore_schedule(bus_schedule &s, const char * filename)
    // open the archive
    std::ifstream ifs(filename);
    boost::archive::xml_iarchive ia(ifs);

    // restore the schedule from the archive

int main(int argc, char *argv[])
    // make  a new schedule
    bus_schedule new_schedule;

    std::string filename(boost::archive::tmpdir());
    filename += "/demo_save.xml";

    restore_schedule(new_schedule, filename.c_str());

    // and display
    std::cout << "\nrestored schedule";
    std::cout << new_schedule;

    return 0;