fork download
  1. #include <iostream>
  2. #include <arpa/inet.h>
  3. using namespace std;
  4.  
  5. int main() {
  6. // your code goes here
  7. char *c = "192.168.1.50";
  8. struct in_addr addr;
  9.  
  10. inet_pton(AF_INET, c, &addr);
  11.  
  12. cout << hex << addr.s_addr << endl;
  13. return 0;
  14. }
Success #stdin #stdout 0.01s 5288KB
stdin
Standard input is empty
stdout
3201a8c0