HPlogo HP-UX IPv6 Porting Guide: HP-UX 11i v2 September 2004 > Chapter 10  Converting Binary and Text Addresses

Converting a Binary Address to Text

» 

Technical documentation

Complete book in PDF

 » Table of Contents

Syntax

inet_ntop(int family, const void *addrptr, char *strptr, site_t len)

The inet_ntop() function call converts an IP address from numeric format to string format. The len parameter specifies the calling function’s buffer size to prevent overflow. Two definitions specify this buffer size for either IPv4 or IPv6 addresses in the <netinet/in.h> header file.

#define		INET_ADDRSTRLEN			16	 /* for IPv4 dotted-decimal */
#define INET6_ADDRSTRLEN 46 /* for IPv6 hex string */
© 2004 Hewlett-Packard Development Company, L.P.