Advertisement
Guest User

Untitled

a guest
May 25th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. #include <arpa/inet.h>
  2. #include <stdlib.h>
  3. #include <stdio.h>
  4. #include <string.h>
  5.  
  6. int main(void)
  7. {
  8. const char *ip6str = "2a03:6300:1:103:211:5bff:fe31:13e1";
  9. const char *first = "2a03:6300:1:103:218:5bff:fe31:13e1";
  10. const char *last = "2a03:6300:1:103:220:5bff:fe31:13e1";
  11.  
  12. struct in6_addr result, resfirst, reslast;
  13.  
  14. inet_pton(AF_INET6, first, &resfirst);
  15. inet_pton(AF_INET6, last, &reslast);
  16. inet_pton(AF_INET6, ip6str, &result);
  17.  
  18. if (memcmp(&result, &resfirst, sizeof(result)) > 0 && memcmp(&result, &reslast, sizeof(result)) < 0 ) {
  19. printf("OOOK\n");
  20. }
  21.  
  22. return 0;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement