Created
April 8, 2021 02:15
-
-
Save alsamitech/05ca8d384c094b56ba616e53c6072d07 to your computer and use it in GitHub Desktop.
Returns IP adress of URL
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
| typedef struct hostent hostent_t; | |
| typedef struct in_addr inaddr_t; | |
| char* dns_nm_to_addr(char* nm){ | |
| hostent_t* hostinfo; | |
| inaddr_t* addr; | |
| hostinfo=gethostbyname(nm); | |
| return inet_ntoa(*(inaddr_t*)(hostinfo->h_addr)); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment