Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <arpa/inet.h>
- #include <stdlib.h>
- #include <stdio.h>
- #include <string.h>
- int main(void)
- {
- const char *ip6str = "2a03:6300:1:103:211:5bff:fe31:13e1";
- const char *first = "2a03:6300:1:103:218:5bff:fe31:13e1";
- const char *last = "2a03:6300:1:103:220:5bff:fe31:13e1";
- struct in6_addr result, resfirst, reslast;
- inet_pton(AF_INET6, first, &resfirst);
- inet_pton(AF_INET6, last, &reslast);
- inet_pton(AF_INET6, ip6str, &result);
- if (memcmp(&result, &resfirst, sizeof(result)) > 0 && memcmp(&result, &reslast, sizeof(result)) < 0 ) {
- printf("OOOK\n");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement