title: How to Extract integer from character
body: <p>I have this code:</p>
  
  <pre><code>            int num[10]   ;            
              sscanf(msg, "%d%d%d%d%", &amp;num[0], &amp;num[1], &amp;num[2], &amp;num[3]); 
              int x = num[0]; // integer
              int y = num[1]; // integer
              int z = num[2]; // integer
              int c = num[3]; // integer
  </code></pre>
  
  <p>I got problem from the above code, when I write '131249', so the result is:</p>
  
  <pre><code>x = 177 
  y = -8755
  z = -21206
  c = -246
  </code></pre>
  
  <p>but the expected value should </p>
  
  <pre><code>x = 13 
  y = 12
  z = 4
  c = 9
  </code></pre>
  
  <p>How to have the expected value, is there any wrong in my code ?</p>