32 bits into unit64 conversion in C++
<p>I want to put a 32 bit value into unsigned int. I want this program to run on platfroms with 32 and 64 bit int too and with both little and big endians. Here is my code</p>

<pre><code>  void uCHarToInt(unsigned char* input, unsigned int* oputput)
  {
       memcpy(oputput, reinterpret_cast&lt;unsigned int*&gt;(&amp;input), 4);

      if (sizeof(unsigned int) == 8) 
      {
           *oputput &gt;&gt;= 32;
      }
  }
</code></pre>

<p>I think this is going to work with big endnian and with 32 and 64 bit integer types, but I am not sure about little endian and how does memcpy behave on different platforms. Isn't there a better solution?</p>