Created
October 15, 2017 05:59
-
-
Save miwarin/c8fbac093bb2edb3a8de4caf7578f665 to your computer and use it in GitHub Desktop.
IPアドレス解析
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
int main(int ac, char** av) | |
{ | |
char *s, *p, *tokens[8]; | |
char *last; | |
int i = 0; | |
s = av[1]; | |
for((p = strtok_r(s, ".", &last)); p; (p = strtok_r(NULL, ".", &last)), i++) | |
{ | |
tokens[i] = p; | |
} | |
tokens[i] = NULL; | |
if(i != 4) | |
{ | |
puts("False"); | |
return 1; | |
} | |
puts("True"); | |
// for(i = 0; tokens[i] != NULL; i++) | |
// { | |
// printf("%s\n", tokens[i]); | |
// } | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment