C++ Reading bytes Problem
<p>I have this issue, I don't know if is expected, here is the thing:</p>

<p>I'm trying to load bytes from a file to an structure like this:</p>

<pre><code>struct
{
    char
    char
    char
    char
    unsigned int
}
</code></pre>

<p>but the problem is when the unsigned int is filled, it seems like in the reading stream the bytes are swapped, e.x. if the file contains 0x45080000, the unsigned int will have 0x84500000, which is wrong.</p>

<p>This can be "solved" if i change the unsigned int for a BYTE[4], but is not what I want. Here is the code that I use to read from the file:</p>

<pre><code>fopen_s( &amp;mFile, "myFile.ext", "rb" );

if( mFile == NULL ) print( " **** E R R O R ! **** " );
else
{
    if( fread( &amp;myStruct, sizeof( MY_Struct ), 1, myFile) != 1)
    {
        print( " **** E R R O R ! **** " );
        return 0;
    }
}
</code></pre>

<p>Is this an expected behavior or what am I doing wrong?</p>

<p>Regards</p>
