Storing header and data sections in a CSV file
Posted
by morpheous
on Stack Overflow
See other posts from Stack Overflow
or by morpheous
Published on 2010-05-19T01:46:59Z
Indexed on
2010/05/19
1:50 UTC
Read the original article
Hit count: 238
c++
This should be relatively easy to do, but after several hours straight programming my mind seems a bit frazzled and could do with some help.
I have a C++ class which I am currently using to store read/write data to file. I was initially using binary data, but have decided to store the data as CSV in order to let programs written in other languages be able to load the data.
The C++ class looks a bit like this:
class BinaryData
{
public:
BinaryData();
void serialize(std::ostream& output) const;
void deserialize(std::istream& input);
private:
Header m_hdr;
std::vector<Row> m_rows;
};
I am simply rewriting the serialize/deserialize methods to write to a CSV file. I am not sure on the "best" way to store a header section and a "data" section in a "flat" CSV file though - any suggestions on the most sensible way to do this?
© Stack Overflow or respective owner