|
Boost Users : |
Subject: [Boost-users] How to get Text Archive with CRLF after each record?
From: Tony Camuso (tcamuso_at_[hidden])
Date: 2015-03-16 18:58:20
I'm just getting one big line, no CRLF in the archive. Makes it difficult
to debug.
Interesting thing is that I was seeing CRLF in a previous archive I created
in another app. There is no difference I can detect in the way I'm archiving
in this app.
Tool chain ...
g++ (GCC) 4.9.2 20150212 (Red Hat 4.9.2-6)
libstdc++-4.9.2-6.fc21.x86_64
libstdc++-devel-4.9.2-6.fc21.x86_64
Code...
typedef std::multimap<unsigned, int> cnodemap_t;
typedef cnodemap_t::value_type cnpair_t;
typedef cnodemap_t::iterator cniterator_t;
typedef std::multimap<unsigned, qnode> qnodemap_t;
typedef qnodemap_t::value_type qnpair_t;
typedef qnodemap_t::iterator qniterator_t;
typedef qnodemap_t::reverse_iterator qnriterator_t;
struct qnode
{
qnode(){}
enum ctlflags flags;
std::string sname;
std::string stypnam;
std::string sdecl;
cnodemap_t parents;
cnodemap_t children;
template<class Archive>
void serialize(Archive &ar, const unsigned int version)
{
if (version){;}
ar & flags & sdecl & sname & parents & children;
}
};
class Cqnodemap
{
public:
Cqnodemap(){}
qnodemap_t qnmap;
template<class Archive>
void serialize(Archive &ar, const unsigned int version)
{
if (version){;}
ar & qnmap;
}
};
static inline void write_cqnmap(const char *filename, Cqnodemap& cqnmap)
{
ofstream ofs(filename, ofstream::out | ofstream::app);
if (!ofs.is_open()) {
cout << "Cannot open file: " << filename << endl;
exit(1);
}
{
boost::archive::text_oarchive oa(ofs);
oa << cqnmap;
}
ofs.close();
}
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