Copying to binary file row of a matrix
<p>I want to write each row of a matrix to a binary file.
I try writing it like this: </p>

<pre><code>vector&lt; vector&lt;uint32_t&gt; &gt; matrix;
</code></pre>

<p>...</p>

<pre><code>for(size_t i = 0; i &lt; matrix.size(); ++i)
ofile-&gt;write( reinterpret_cast&lt;char*&gt;(&amp;matrix[i]), sizeof(uint32_t*sizeof(matrix[i])) );
{
    for(size_t j = 0; j &lt; numcols; ++j)
    {
        std::cout &lt;&lt; left &lt;&lt; setw(10) &lt;&lt; matrix[i][j];
    }
    cout &lt;&lt; endl;
}
</code></pre>

<p>but it doesn't work, I get garbage numbers. </p>

<p>Any help appreciated,</p>

<p>Ted.</p>
