inet_aton |
Prototype: |
#include <arpa/inet.h>
int inet_aton(const char* ip_addr, struct in_addr *addr);
|
General Description: |
Converts a human-readable IP address from the dot-notation to the binary, network-byte ordered form. This call replaces inet_addr(). |
Return Value: |
NONZERO if everything goes well. If an error occurs, the call returns a zero. |
Parameters |
ip_addr |
The ASCII string of the IP address (for example, 187.34.2.1). |
addr |
The destination. Typically, you would populate the sin_addr field from the sockaddr_in structure. |
Possible Errors |
(errno not set) |
|
|
Examples |
Struct sockaddr_in addr;
if ( inet_aton("187.43.32.1", &addr.sin_addr) == 0 )
perror("inet_aton() failed");
|