The inet_addr function


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


The system include file contains the following declaration for the inet_addr function:

 function inet_addr(cp : address) : u_long;
  external dll='ws2_32.dll';


The only argument passed to the inet_addr function is the operating system address of the buffer containing the host address as a null-terminated string. You should use the the built-in function addr to get the operating system address of this buffer.

Return Values

The inet_addr function returns an unsigned long value containing the host address represented as a numeric value, if the call is successful. If an error occurs then the value INADDR_NONE is returned.

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