1,字符串转数值
char s[]="0xA";
int i;i = strtol(s, NULL, 16);
printf("%d", i);
2,字符串IP地址转数组
char s1 []="192.168.0.1";
char s2
[]="2a01:198:603:0:396e:4789:8e99:8901";
inet_pton(AF_INET,s1,ip);
inet_pton(AF_INET6,s1,ip);
1,字符串转数值
char s[]="0xA";
int i;printf("%d", i);
2,字符串IP地址转数组
char s1 []="192.168.0.1";
char s2
[]="2a01:198:603:0:396e:4789:8e99:8901";
inet_pton(AF_INET,s1,ip);
inet_pton(AF_INET6,s1,ip);