/*************************************************************************
> File Name: hex2add.c
> Author: cat
> Mail: [email protected]
************************************************************************/
#include<stdio.h>
#include<stdlib.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
int main(int argc, char **argv)
{
if (argc != 2) {
printf("usage: %s <addr>\n", argv[0]);
exit(-1);
}
unsigned int temp = (unsigned int) strtol(argv[1], NULL, 16);
struct in_addr addr;
addr.s_addr = htonl(temp);
printf("the ip address is %s\n", inet_ntoa(addr));
return 0;
}
/*************************************************************************
> File Name: hex2add.c
> Author: cat
> Mail: [email protected]
************************************************************************/
#include<stdio.h>
#include<stdlib.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
int main(int argc, char **argv)
{
if (argc != 2) {
printf("usage: %s <addr>\n", argv[0]);
exit(-1);
}
unsigned int temp = (unsigned int) strtoll(argv[1], NULL, 16);
struct in_addr addr;
addr.s_addr = htonl(temp);
printf("the ip address is %s\n", inet_ntoa(addr));
return 0;
}