inet_ntop function winsock

Win32Result<PCSTR> inet_ntop(
  1. int family,
  2. Pointer<NativeType> pAddr,
  3. PSTR pStringBuf,
  4. int stringBufSize,
)

Converts an IPv4 or IPv6 Internet network address into a string in Internet standard format.

The ANSI version of this function is inet_ntop.

To learn more, see learn.microsoft.com/windows/win32/api/ws2tcpip/nf-ws2tcpip-inet_ntop.

Implementation

Win32Result<PCSTR> inet_ntop(
  int family,
  Pointer pAddr,
  PSTR pStringBuf,
  int stringBufSize,
) {
  final result_ = inet_ntop_Wrapper(family, pAddr, pStringBuf, stringBufSize);
  return .new(value: .new(result_.value.ptr.cast()), error: result_.error);
}