The inet_ntoa function

Description

The inet_ntoa function converts a host address from a numeric value into a null-terminated string.

Declaration

The system include file WinSock2.inc contains the following declarations for the in_addr type, and the inet_ntoa function:

 in_addr = u_long;

 function inet_ntoa(inaddr : in_addr) : address;
  external dll='ws2_32.dll';

Arguments

The only argument passed to the inet_ntoa function is host address, represented as a numeric value.

Return Values

The inet_ntoa function returns the operating system address of a buffer containing a null-terminated string representing the Internet address, if the call is successful. If the call fails zero is returned. When the inet_ntoa function call succeeds, the buffer returned resides in memory that is allocated by Windows Sockets. Your program The application should not make any assumptions about the way in which the memory is allocated. The data in the buffer is guaranteed to be valid until the next Windows Sockets function call within the same thread. You should copy the null-terminated string from the buffer before calling any other Windows Sockets functions.

Reference Information

The authoritative source of information about the WinSock2 library is the Microsoft Developers Network (MSDN). You can access the MSDN on the Microsoft website at msdn.microsoft.com.