问题
Is it possible to get all network interfaces(whether up or down) name and available information in Linux using c++? I mean a program that only uses API to get interface's name. Does "ioctl" print down interfaces?
回答1:
Not specially for C++, but you can use the C API and the 'getifaddrs' function to do so: http://man7.org/linux/man-pages/man3/getifaddrs.3.html
来源:https://stackoverflow.com/questions/18495619/how-to-get-all-network-interface-name-and-information-in-c