Boost logo

Boost :

Subject: [boost] Boost Serialization problem
From: Suhail (suhail_pk1_at_[hidden])
Date: 2009-04-24 08:12:45


Hallo

I have currently installl the Boost boost_1.38 .

Start new program in VC2003
add following lib in my project

boost_serialization-vc71-mt-1_38.lib
boost_serialization-vc71-mt-gd-1_38.dll

example code:

#include <boost/archive/text_oarchive.hpp>
#include <boost/archive/text_iarchive.hpp>
#include <iostream>
#include <fstream>
#include <stdio.h>

using namespace std;

void save()
{
  std::ofstream file("archiv.txt");
  boost::archive::text_oarchive oa(file);
  int i = 7;
  oa << i;
}

void load()
{
  std::ifstream file("archiv.txt");
  boost::archive::text_iarchive ia(file);
  int i = 0;
  ia >> i;
  std::cout << i << std::endl;
}

//==========================================================
/// Main function
//==========================================================
void main(int argc, char* argv[])
{
    save();
    load();
}

After executing this example "archiv.txt" only stores 22 serialization::archive 5
instead of 22 serialization::archive 5 1

Could someone help me where i am making mistake??


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk