Rather than using other processes, look into the System Configuration framework.
- Gary L. Wade (Sent from my iPhone) On Jul 21, 2011, at 8:28 AM, Leonardo <mac.iphone....@gmail.com> wrote: > Hi, > while on MacOs X 10.6 and earlier this piece of code worked properly, on > Lion I get a different result (bug). > I have to take the MacAddress en0. May you please tell me where I do wrong? > > NSString *tempFilePath = @"/Users/john/OutCocoa.txt"; > NSString *commandLine = [NSString stringWithFormat:@"/sbin/ifconfig en0 | > grep ether | cut -d' ' -f 2 > \"%@\" 2>&1", tempFilePath]; > sprintf(cmd, "/bin/sh -c %s", [commandLine UTF8String]); > > On Leopard this code returned the true en0 (good). > On Lion this code returns 3 MacAddresses, where the en0 is the 3rd one > (bug). I have fixed the bug just deleting the "/bin/sh -c " in front of the > command, this way: > sprintf(cmd, "%s", [commandLine UTF8String]); > > So now on Lion it works well too. My questions are: > 1) Will it work well on any machine? > 2) Will it work well on Leopard too? > 3) Why do I get the bug on Lion only? > > Of course I am getting a lot of troubles with machines who are trying to run > my app on Lion today... > > > Regards > -- Leonardo _______________________________________________ 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