<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta name="Copyright" content="Copyright (c) 2006 by IBM Corporation"> <title>inet_ntoa()--Translate IP Address to Dotted Decimal Format</title> <!-- Begin Header Records ========================================== --> <!-- All rights reserved. Licensed Materials Property of IBM --> <!-- US Government Users Restricted Rights --> <!-- Use, duplication or disclosure restricted by --> <!-- GSA ADP Schedule Contract with IBM Corp. --> <!-- Change History: --> <!-- YYMMDD USERID Change description --> <!-- Unix8 SCRIPT J converted by B2H R4.1 (346) (CMS) by V2KEA304 --> <!-- at RCHVMW2 on 17 Feb 1999 at 11:05:09 --> <!-- Edited by Kersten Feb 02 --> <link rel="stylesheet" type="text/css" href="../rzahg/ic.css"> </head> <body> <!--End Header Records --> <!-- Java sync-link --> <script type="text/javascript" language="Javascript" src="../rzahg/synch.js"> </script> <a name="Top_Of_Page"></a> <h2>inet_ntoa()--Translate IP Address to Dotted Decimal Format</h2> <div class="box" style="width: 70%;"><br> Syntax<br> <pre> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> char *inet_ntoa(struct in_addr <em>internet_address</em>) </pre> <br> Service Program Name: QSOSRV2<br> <!-- iddvc RMBR --> <br> Default Public Authority: *USE<br> <!-- iddvc RMBR --> <br> Threadsafe: No; see <a href="#USAGE_NOTES">Usage Notes</a>.<br> <!-- iddvc RMBR --> <br> </div> <p>The <em>inet_ntoa()</em> function is used to translate an Internet address from a 32-bit IP address to dotted decimal format.</p> <br> <!-- Please NOTE: DO NOT DELETE THIS SECTION if this API has no authorities and locks. --> <!-- Instead, use the commented out coding below to indicate NONE. --> <h3>Authorities and Locks</h3> <!-- Use this if there are no authorities and locks. --> <p>None.</p> <br> <h3>Parameters</h3> <dl> <dt><strong>internet_address</strong></dt> <dd>(Input) The 32-bit IP address that is to be converted to dotted decimal format.</dd> </dl> <br> <h3>Return Value</h3> <p><em>inet_ntoa()</em> returns one of the following values: </p> <ul> <li>NULL (unsuccessful)<br> <br> </li> <li>s (where s is the pointer to the Internet address in dotted decimal format)</li> </ul> <br> <h3><a name="USAGE_NOTES">Usage Notes</a></h3> <ol> <li>The pointer returned by <em>inet_ntoa()</em> points to static storage that is overridden on subsequent <em>inet_ntoa()</em> functions.<br> <br> </li> <li>Do not use the <em>inet_ntoa()</em> function in a multithreaded environment. See the multithread alternative <em>inet_ntoa_r</em> function.</li> </ol> <br> <hr> API introduced: V4R2 <hr> <center> <table cellpadding="2" cellspacing="2"> <tr align="center"> <td valign="middle" align="center"><a href="#Top_Of_Page">Top</a> | <a href= "unix.htm">UNIX-Type APIs</a> | <a href="aplist.htm">APIs by category</a> </td> </tr> </table> </center> </body> </html>