In C++, how do I correctly load a file into an array of wider than char data types?
<p>Specifically, I'm trying to program an FPGA with a binary file.  The transaction register is 16-bits wide.  So I need to create an array of uint16_t and fill it with an input file.  Here is what I tried:</p>

<pre><code>int bufferSize = 512;
uint16_t buffer[bufferSize];
std::ifstream *pStream = new std::ifstream( filepath );
if( pStream-&gt;is_open() == true )
{
   pStream-&gt;read( (char *)buffer, bufferSize );
}
</code></pre>

<p>From what I can tell through GDB, it seems each array node is backwards (ie. expected 0xBEEF, got 0xEFBE)</p>
