1
0
mirror of https://github.com/mfontanini/libtins synced 2026-01-23 02:35:57 +01:00

Add friendly name to interface info example

This commit is contained in:
Matias Fontanini
2016-02-06 16:04:51 -08:00
parent 0832184896
commit 64b267c7ea

View File

@@ -32,6 +32,7 @@
#include <tins/network_interface.h> #include <tins/network_interface.h>
using std::cout; using std::cout;
using std::wcout;
using std::endl; using std::endl;
using std::string; using std::string;
@@ -50,7 +51,14 @@ int main() {
NetworkInterface::Info info = iface.info(); NetworkInterface::Info info = iface.info();
// Now print all of this info. // Now print all of this info.
cout << name << ": " << endl; cout << name;
#ifdef _WIN32
// If this is running on Windows, also print the friendly name
wcout << " (" << iface.friendly_name() << ")";
#endif // _WIN32
cout << ": " << endl;
cout << " HW address: " << info.hw_addr << endl cout << " HW address: " << info.hw_addr << endl
<< " IP address: " << info.ip_addr << endl << " IP address: " << info.ip_addr << endl
<< " Netmask: " << info.netmask << endl << " Netmask: " << info.netmask << endl