Converts a numeric address to a text string suitable for
presentation.
Format
#include <inet.h>
const char *inet_ntop ( int af, const void *src, char *dst,
size_t size );
1 – Arguments
af
Specifies the address family. Valid values are AF_INET for an
IPv4 address and AF_INET6 for an IPv6 address.
src
Points to a buffer that contains the numeric IP address.
dst
Points to a buffer that is to contain the text string.
size
Specifies the size of the buffer pointed to by the dst parameter.
For IPv4 addresses, the minimum buffer size is 16 bytes. For IPv6
addresses, the minimum buffer size is 46 bytes. INET_ADDRSTRLEN
constants are defined in the IN.H header file. INET6_ADDRSTRLEN
constants are defined in IN6.H.
2 – Description
This function converts a numeric IP address value to a text
string.
3 – Return Values
Pointer to the Success
buffer containing
the text string
Pointer to the Failure
buffer containing
NULL