Boost logo

Boost :

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


I have currently installl the Boost boost_1.38 .

Start new program in VC2003
add following lib in my project


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[])

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, gregod at, cpdaniel at, john at