|
Boost Users : |
From: Robert Ramey (ramey_at_[hidden])
Date: 2006-07-31 19:03:19
I wouldn't expect this work. Try
std::ofstream ofs("C:\\Save.xml");
const wchar_t * ptr;
ptr=m_strEdit.GetBuffer();
assert(ofs.good());
boost::archive::xml_oarchive oa(ofs);
oa.save(ptr);
wchar_t *nptr; // note change here !!!
std::ifstream ifs("C:\\Save.xml");
boost::archive::xml_iarchive ia(ifs,0);
ia.load(nptr);
ifs.close();
For an explanation of why this works (assuming it actually does)
and why your original can't, read the documentation regarding the
serialization of pointers.
Robert Ramey
"Bruno Poinas" <bpoinas_at_[hidden]> wrote in message
news:D0D608FD34E14C4BA93A30AC162651E11F38F6_at_SERVEUR2003.acticm.com...
Hello,
I just recently began using the boost library, I want to write and read
string to serialized objects with the function 'xml_oarchive' and
'xml_iarchive'.
When I execute this code (with visual c++.net v. 7.1) :
std::ofstream ofs("C:\\Save.xml");
const wchar_t * ptr;
ptr=m_strEdit.GetBuffer();
assert(ofs.good());
boost::archive::xml_oarchive oa(ofs);
oa.save(ptr);
wchar_t str[512];
std::ifstream ifs("C:\\Save.xml");
boost::archive::xml_iarchive ia(ifs,0);
ia.load(str);
ifs.close();
the programm failed :
Thanks and regards,
Bruno POINAS
ActiCM S.A.
122, rue du Rocher de Lorzier - Centr'Alp - 38430 - MOIRANS
_______________________________________________
Boost-users mailing list
Boost-users_at_[hidden]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
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