title: parsing ip adress string in 4 single bytes
body: <p>I'm programming on a MCU with C and I need to parse a null-terminated string which contains an IP address into 4 single bytes. I made an example with C++:</p>
  
  <pre><code>#include &lt;iostream&gt;
  int main()
  {
      char *str = "192.168.0.1\0";
      while (*str != '\0')
      {
              if (*str == '.')
              {
                      *str++;
                      std::cout &lt;&lt; std::endl;
              }
              std::cout &lt;&lt; *str;
              *str++;
      }
      std::cout &lt;&lt; std::endl;
      return 0;
  }
  </code></pre>
  
  <p>This code prints 192, 168, 0 and 1 each byte in a new line. Now I need each byte in a single char, like char byte1, byte2, byte3 and byte4 where byte1 contains 1 and byte4 contains 192... or in a struct IP_ADDR and return that struct then, but I dont know how to do it in C. :(</p>