Contents | Prev | Next

12.16.7 The inet_addr function

Description

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

Declaration

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

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

Arguments

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 msdn.microsoft.com.

Contents | Prev | Next