title: Hex char to int conversion
body: <p>I'm reading data from UART byte by byte. This is saved to a char.
  The byte following the start byte gives the number of subsequents bytes incoming (as a hexadecimal). I need to convert this hex number to an integer, to keep count of bytes required to be read.</p>
  
  <p>Presently I'm simply type-casting to int. Here's my code:</p>
  
  <pre><code>char ch;
  int bytes_to_read;
  while(1){
      serial_read(UART_RX, &amp;ch, sizeof(char));
      if(/*2nd byte*/){
          bytes_to_read = (int)ch;
      }
  }
  </code></pre>
  
  <p>I read about strtol(), but it takes char arrays as input. What's the right way to do this?</p>