title: Convert char byte to integer value
body: <p>For example , <strong>130ABF</strong> (Hexadecimal) is equals to <strong>1247935</strong> (Decimal),
  So my byte array is  </p>
  
  <pre><code> char buf[3] = {0x13 , 0x0A , 0xBF};
  </code></pre>
  
  <p>and I need to retrieve the decimal value from the byte array.</p>
  
  <p>Below are my sample code:</p>
  
  <pre><code>#include&lt;iostream&gt;
  using namespace std;
  int main()
  {
      char buf[3] = {0x13 , 0x0A , 0xBF};
      int number = buf[0]*0x10000 + buf[1]*0x100 + buf[2];
      cout&lt;&lt;number&lt;&lt;endl;
      return 0;
  }
  </code></pre>
  
  <p>and the result is : (Wrong)</p>
  
  <pre><code>1247679
  </code></pre>
  
  <p>Unless I change the </p>
  
  <pre><code>char buf[3] = {0x13 , 0x0A , 0xBF};
  </code></pre>
  
  <p>to</p>
  
  <pre><code>int buf[3] = {0x13 , 0x0A , 0xBF};
  </code></pre>
  
  <p>then It will get correct result.</p>
  
  <p>Unfortunately, I must set my array as <strong>char</strong> type,  anyone know how to solve this ?</p>