Write uint16_t to binary file with ofstream
<p>I am trying to test writing some data to a file. </p>

<pre><code>sixteenBitData = (uint16_t*) malloc(sizeof(uint16_t)*bufSizeX*bufSizeY);
memset(sixteenBitData, 1, sizeof(uint16_t)*bufSizeX*bufSizeY);
binfile-&gt;write((char *)&amp;sixteenBitData, sizeof(uint16_t)*bufSizeX*bufSizeY);
</code></pre>

<p>as you can see, sixteenBitData is an array of uint16_t</p>

<p>I would expect my binary file to have a bunch of 1's it, but when I am loading it into matlab, it seems to have various numbers between 0 and 65535</p>

<p>Am I doing something wrong?</p>

<p>Thanks</p>
