List of network interface names, using C with Wins

2020-02-06 16:41发布

问题:

In Windows' C API, how can you get a list of network interface names? (Equivalent to getifaddrs() in Linux)

The WSAIoctl(sock, SIO_GET_INTERFACE_LIST_EX, ...) function seems to only return IP addresses, plus a little metadata.

回答1:

GetAdaptersAddresses() does this.

Use GetIpAddrTable() if you are interested in IPv4 addresses only.