Reputation: 21
Does any one know any C++ code to get the name of all network interface available on the computer with there types that is wired or wireless. It will be also equally good if only all interfaces name are available.I want to this with the help of ioctl library e.g.,
ioctl(sd, SIOCGIFNAME, &ifr);
strncpy(ifname,ifr.ifr_name,IFNAMSIZ);
printf("Interface name :%s\n",ifname);
actully the above way is not working.
Thanks
Upvotes: 2
Views: 1086
Reputation: 21
Thanks. But I have found another way i.e. to read the /proc/net/dev file to get the list of all interfaces on the system.
Upvotes: 0