Hi there,

as a quick pointer - from one of my apps licensing code. Assuming that MACAddress is the beasty UInt8 struct, the following should work:


NSString *addressString = [[NSString alloc] initWithFormat:@"%02x: %02x:%02x:%02x:%02x:%02x",MACAddress[0], MACAddress[1], MACAddress[2], MACAddress[3], MACAddress[4], MACAddress[5]];


Cheers,
Volker

Am 19.02.2009 um 19:26 schrieb Jon C. Munson II:

Namaste!

Per Apple's GetPrimaryMACAddress sample (found in Technical Note TN1103), I
can obtain a MAC address for a given Mac.

However, when I try to output that address to the screen, I get nothing.

So, my issue is, what do I do with the return value found inside that sample
so that it is output in the "standard" format of a MAC address?

The return value from IO Kit is a UInt8 struct which is filled with the
bytes of the MAC address.

I need to convert that to an NSString.  Which I did using
stringWithUTF8Format - the raw conversion works fine. However, due to the
actual characters in the string, the return string isn't valid.

I'm guessing I need to do some further conversion prior to passing back the actual string, but not sure what, nor how. It looks preliminarily to me that I need to change the UInt8 byte array to an array that contains the hex values of said bytes - is that correct? If so, how do I do that (as simple as obtaining the character codes?)? I know that may be a noob question, but
I'm not usually delving into the lower levels of such stuff so I don't
remember - sorry!

Thanks!!!

Peace, Love, and Light,

/s/ Jon C. Munson II



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/volker_lists%40ecoobs.de

This email sent to volker_li...@ecoobs.de

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to