Storing header and data sections in a CSV file
<p>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.</p>

<p>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.</p>

<p>The C++ class looks a bit like this:</p>

<pre><code>class BinaryData
{
public:
   BinaryData();

   void serialize(std::ostream&amp; output) const;
   void deserialize(std::istream&amp; input);   

private:
   Header m_hdr;
   std::vector&lt;Row&gt; m_rows;
};
</code></pre>

<p>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?</p>
