inet_aton()

convert Internet dot address to network address 

Function


SYNOPSIS

#include <arpa/inet.h>

int inet_aton(const char *cp, struct in_addr *addr);


DESCRIPTION

The inet_aton() function converts the specified string, in the Internet standard dot notation, to a network address, and stores the address in the structure provided.

The converted address is in network byte order (bytes ordered from left to right).

Values specified using dot notation take one of the following forms:

a.b.c.d 

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.

a.b.c 

When a three-part address is specified, the last part is interpreted as a 16-bit quantity and placed in the rightmost two bytes of the network address. This makes the three-part address format convenient for specifying Class B network addresses as 128.net.host.

a.b 

When a two-part address is supplied, the last part is interpreted as a 24-bit quantity and placed in the rightmost three bytes of the network address. This makes the two-part address format convenient for specifying Class A network addresses as net.host.

a 

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 dot notation may be decimal, octal, or hexadecimal, as specified in the ISO C standard (that is, a leading 0x or 0X implies hexadecimal; otherwise a leading 0 implies octal; otherwise, the number is interpreted as decimal).


PARAMETERS

cp 

Points to a string in Internet standard dot notation.

addr 

Buffer where the converted address is to be stored.


RETURN VALUES

The inet_aton() function returns 1 if the address is successfully converted, or 0 if the conversion failed.


CONFORMANCE

4.4BSD


MULTITHREAD SAFETY LEVEL

MT-Safe.


PORTING ISSUES

None.


AVAILABILITY

PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Functions:
inet_addr(), inet_lnaof(), inet_makeaddr(), inet_net_ntop(), inet_net_pton(), inet_neta(), inet_netof(), inet_network(), inet_ntoa(), inet_ntop(), inet_pton()


PTC MKS Toolkit 9.6 Documentation Build 9.