title: Convert char to short
body: <p>I need to copy the data from 2 <code>char</code> (8 bit long) to a single <code>short</code> (16 bit long). I tried two different ways, but can't get it to work.</p>
  
  <pre><code>void char2short(char* pchar, short* pshort)
  {
      memcpy(pshort    , pchar + 1    , 1);
      memcpy(pshort + 1, pchar    , 1);
  }
  </code></pre>
  
  <p>And the other one:</p>
  
  <pre><code>void char2short(char* pchar, short* pshort)
  {
     short aux;
     aux = ((*pchar &amp; 0x00FF) &lt;&lt; 8) | ((*(pchar+1) &amp; 0xFF00) &gt;&gt; 8);
     *pshort = aux;
  }
  </code></pre>