Last active
June 16, 2016 14:27
-
-
Save IS-BrianLian/ad25eee296a41bdebb0013d801516a80 to your computer and use it in GitHub Desktop.
ipaddr_input
This file contains hidden or 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> | |
int main() { | |
uint32_t ipaddr; | |
ipaddr = 3764655192ul; // 224.100.20.88 | |
printf("%d.%d.%d.%d\n", | |
(ipaddr>>24)&0xFF, | |
(ipaddr>>16)&0xFF, | |
(ipaddr>> 8)&0xFF, | |
(ipaddr )&0xFF); | |
ipaddr = htonl(ipaddr); | |
printf("%d.%d.%d.%d\n", | |
(ipaddr>>24)&0xFF, | |
(ipaddr>>16)&0xFF, | |
(ipaddr>> 8)&0xFF, | |
(ipaddr )&0xFF); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment