Converts Internet addresses in text form into numeric (binary) Internet addresses.
#include <in.h> #include <inet.h> int inet_addr (char *cp);
Internet addresses specified using the "." notation take one of the following forms:
a.b.c.d a.b.c a.b a
When four parts are specified, each is interpreted as a byte of data and assigned, from left to right, to the four bytes of an Internet address. Note that when an Internet address is viewed as a 32-bit integer quantity on VAX systems, the bytes previously referred to appear in binary as "d.c.b.a". That is, VAX bytes are ordered from least significant to most significant.
When only one part is given, the value is stored directly in the network address without any byte rearrangement.
All numbers supplied as "parts" in a "." address expression may be decimal, octal, or hexadecimal, as specified in the C language (that is, a leading 0x or 0X implies hexadecimal; a leading 0 implies octal; otherwise, the number is interpreted as decimal).
-1 | Indicates that cp does not point to a proper Internet address. |
x | An Internet address in network byte order. |