InetFormatAddress Function  
 
VOID WINAPI InetFormatAddress(
  LPINTERNET_ADDRESS lpAddress,  
  LPTSTR lpszAddress,  
  INT cchAddress  
);

The InetFormatAddress function converts a numeric IP address to a printable string. The format of the string depends on whether an IPv4 or IPv6 address is specified.

Parameters

lpAddress
A pointer to an INTERNET_ADDRESS structure which specifies the numeric IP address that should be converted to a string.
lpszAddress
A pointer to a string buffer that will contain the formatted IP address, terminated with a null character. To accommodate both IPv4 and IPv6 addresses, this buffer should be at least 46 characters in length.
cchAddress
The maximum number of characters that can be copied into the address buffer.

Return Value

None.

Remarks

The format and length of IPv4 and IPv6 address strings are very different. An IPv4 address string looks like "192.168.0.20", while an IPv6 address string can look something like "fd7c:2f6a:4f4f:ba34::a32". If your application checks for the format of these address strings, it needs to be aware of the differences. You also need to make sure that you're providing enough space to display or store an address to avoid buffer overruns.

Requirements

Client: Requires Windows 7, Windows Vista or Windows XP.
Server: Requires Windows Server 2008 or Windows Server 2003.
Header: Include cswsock7.h.
Library: Use cswskav7.lib.
Unicode: Implemented as Unicode and ANSI versions.

See Also

InetGetExternalAddress, InetGetHostAddress, InetGetLocalAddress, InetGetPeerAddress, INTERNET_ADDRESS