|
Boost Users : |
From: Deane Yang (deane_yang_at_[hidden])
Date: 2006-10-06 12:13:09
The code below won't compile for me using VC8. Can someone explain? I'm
sure I'm doing something dumb, but I'm too dumb to know what.
#include <boost/archive/xml_oarchive.hpp>
#include <iostream>
#include <fstream>
struct Object
{
char* ptr;
};
int main (int argc, char* argv[])
{
try
{
std::cout << "Saving portfolio to archive...\n";
Object object;
object.ptr = new char[10];
for (int i= 0; i < 10; ++i)
{
object.ptr[i] = 'i';
}
std::ofstream ofs(filename);
assert(ofs.good());
boost::archive::xml_oarchive oa(ofs);
const Object& obj(object);
oa << BOOST_SERIALIZATION_NVP(obj);
}
catch (const xml_schema::exception& e)
{
std::cerr << e << std::endl;
return 1;
}
}
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