Re: Mac hardware addresses
Re: Mac hardware addresses
- Subject: Re: Mac hardware addresses
- From: Michael Smith <email@hidden>
- Date: Wed, 15 Jul 2009 00:53:28 -0700
On Jul 14, 2009, at 3:10 PM, Todd Heberlein wrote: Look at getifaddrs(2). It's far and away the easiest way to do this. Walk the list you get back looking for AF_LINK addresses (and anything else you want at the same time).
Thanks. In case someone runs across this thread in the future when looking to solve a similar problem, here is some C++ test code that prints the ethernet addresses on my machine.
You might want to look at link_ntoa(3) and addr2ascii(3), as either of these would trivialise your code.
Also, you forgot to call freeifaddrs() at the end of your example.
= Mike -- The lyf so short, the craft so long to lerne -- Chaucer
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden