[ Previous | Next | Contents | Glossary | Home | Search ]
AIX Version 4.3 Communications Technical Reference, Volume 2

inet_ntoa Subroutine


Converts an Internet address into an ASCII string.


Standard C Library (libc.a)


#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
char *inet_ntoa (InternetAddr)
struct in_addr InternetAddr;


The inet_ntoa subroutine takes an Internet address and returns an ASCII string representing the Internet address in dot notation. All Internet addresses are returned in network order, with the first byte being the high-order byte.

Use C language integers when specifying each part of a dot notation.


InternetAddr Contains the Internet address to be converted to ASCII.

Return Values

Upon successful completion, the inet_ntoa subroutine returns an Internet address.

If the inet_ntoa subroutine is unsuccessful, the subroutine returns a -1.

Implementation Specifics

The inet_ntoa subroutine is part of Base Operating System (BOS) Runtime.

All applications containing the inet_ntoa subroutine must be compiled with _BSD set to a specific value. Acceptable values are 43 and 44. In addition, all socket applications must include the BSD libbsd.a library.


                          Contains host names.
                          Contains network names.

Related Information

The endhostent subroutine, endnetent subroutine, gethostbyaddr subroutine, gethostbyname subroutine, getnetbyaddr subroutine, getnetbyname subroutine, getnetent subroutine, inet_addr subroutine, inet_lnaof subroutine, inet_makeaddr subroutine, inet_network subroutine, sethostent subroutine, setnetent subroutine.

Sockets Overview and Understanding Network Address Translation in AIX Version 4.3 Communications Programming Concepts.

[ Previous | Next | Contents | Glossary | Home | Search ]