![]() |
![]() |
![]() |
Convert a string into an Internet address stored in a structure
#include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> int inet_aton( const char* cp, struct in_addr* pin );
libsocket
The inet_aton() routine interprets the specified character string as an Internet address, placing the address into the structure provided.
All Internet addresses are returned in network byte order (bytes are ordered from left to right). All network numbers and local address parts are returned as machine-format integer values.
Using the dot notation, you can specify addresses in one of the following forms:
net.net.host
net.host
All numbers supplied as "parts" in a dot notation may be decimal, octal, or hex, as specified in the C language. That is, a number is interpreted as decimal unless it has a leading 0 (octal), or a leading 0x or 0X (hex).
Safety: | |
---|---|
Cancellation point | No |
Interrupt handler | Yes |
Signal handler | Yes |
Thread | Yes |
gethostbyname(), getnetent() inet_addr(), inet_lnaof(), inet_makeaddr(), inet_netof(), inet_network(), inet_ntoa()
/etc/hosts, /etc/networks in the Utilities reference
![]() |
![]() |
![]() |