1 2 3 4 5 6 7 8
#include <sys/types.h> #include <sys/socket.h> #include <net/if.h> int main() { static char ifname[IFNAMSIZ]; char *tmp=if_indextoname(0,ifname); }