title: Converting from char* to int
body: <p>My code fails and returns a really big number:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  int main()
  {
      char *s = "hello123";
      printf("%d\n",*(int *)s);
      return 0;
  }
  </code></pre>
  
  <p>with atoi it returns 0, any ideas? </p>
  
  <p>What im trying to achieve is:
  for example im sending "hello123" to a server software, the server software should get the "123" numeric in the string, doing this by this method:</p>
  
  <pre><code>uint16_t get_uint16(NetworkMessage *message)
  {
      uint16_t ret = 0;
      if (!message || !message-&gt;buffer)
          return 0;
  
      ret = *(uint16_t *)(message-&gt;buffer + message-&gt;position);
      message-&gt;position += sizeof(uint16_t);
      return ret;
  }
  </code></pre>