inet_ntoa() — Get the decimal Internet host address
Standards
Standards / Extensions | C or C++ | Dependencies |
---|---|---|
XPG4.2 |
both |
Format
X/Open:
#define _XOPEN_SOURCE_EXTENDED 1
#include <arpa/inet.h>
char *inet_ntoa(struct in_addr in);
Berkeley
sockets:
#define _OE_SOCKETS
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
char *inet_ntoa(struct in_addr in);
General description
The inet_ntoa()
function returns a pointer to a string expressed in the dotted-decimal
notation. inet_ntoa() accepts an Internet address expressed as a 32-bit
quantity in network byte order and returns a string expressed in dotted-decimal
notation.
- Parameter
- Description
- in
- The host Internet address.
To provide an ASCII input/output format for applications using this function, define feature test macro __LIBASCII as described __LIBASCII.
Note: The
inet_ntoa() function has a dependency on the level of the Enhanced
ASCII Extensions. See Enhanced ASCII support for
details.
Special behavior for C++: To use this function with C++, you must use the _XOPEN_SOURCE_EXTENDED 1 feature test macro.
Returned value
Returns a pointer to the Internet address expressed in dotted-decimal notation. The storage pointed to exists on a per-thread basis and is overwritten by subsequent calls.
Related information
- arpa/inet.h
- netinet/in.h
- sys/socket.h
- sys/types.h
- inet_addr() — Translate an Internet address into network byte order
- inet_lnaof() — Translate a local network address into host byte order
- inet_makeaddr() — Create an Internet host address
- inet_netof() — Get the network number from the Internet host sddress
- inet_network() — Get the network number from the decimal host address
- inet_ntop() — Convert Internet address format from binary to text
- inet_pton() — Convert Internet address format from text to binary