title: how to convert IP address in char[] to Uint32_t in c?
body: <p>I write a program which takes IP address as an argument and i wanted to store this IP address in the unit32_t. I can easily convert uint32_t to back to character array. How to convert IP address in Char Array to uint32_t.</p>
  <p>For example</p>
  <blockquote>
  <p>./IPtoCHAR 1079733050</p>
  </blockquote>
  <p>uint32_t to IP Address =&gt; 64.91.107.58</p>
  <p>But how to write a program that does the reverse task?</p>
  <blockquote>
  <p>./CHARtoIP 64.91.107.58</p>
  </blockquote>
  <hr />
  <p>for the first IPtoCHAR, it is</p>
  <blockquote>
  <p>unsigned int ipAddress = atoi(argv[1]);</p>
  <p>printf(&quot;IP Address %d.%d.%d.%d \n&quot;,((ipAddress &gt;&gt; 24) &amp; 0xFF),((ipAddress &gt;&gt; 16) &amp; 0xFF),((ipAddress &gt;&gt; 8) &amp; 0xFF),(ipAddress &amp; 0xFF));</p>
  </blockquote>
  <p>But all these below does not work</p>
  <blockquote>
  <p>uint32_t aa=(uint32_t)(&quot;64.91.107.58&quot;);</p>
  <p>uint32_t aa=atoi(&quot;64.91.107.58&quot;);</p>
  <p>uint32_t aa=strtol(&quot;64.91.107.58&quot;,NULL,10);</p>
  </blockquote>