Jump to content

Fixing all ethernet issues


1 post in this topic

Recommended Posts

Guest BuildSmart

I've devised a small test that will show me who is capable of assisting in this project area and while some will think it's a stupid test, it will show me that the fundamentals skills required are present.

 

The only requirements is that you know a little programming, you don't need to know anything about the ethernet or it's detection but you must be able to do a little programming without me giving you the changes/fixes.

 

The test is simple, examine the following code and tell me if there is a problem and what the problem is and send me your answer in a PM.

#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>
#include <unistd.h>

@implementation Foo

unsigned char hostid[6] = "\x6\x4\x3\x4\x5\x6";

- (BOOL) printresult
{
char hostHex[16];
int for_loop;
char myStr[2]="00";
NSMutableString *str;

for (for_loop = 0; for_loop < 6; for_loop++){
	sprintf(myStr,"%02X",hostid[for_loop]); // ugly string kludge here for output... 
	hostHex[2*for_loop]=myStr[0];
	hostHex[2*for_loop+1]=myStr[1];
}
hostHex[12] = 0;

str = [NSString stringWithFormat:@"MAC Address: %s\n",hostHex];
printf("MAC Address: %s\n",hostHex);
[serial setStringValue: str];
return YES;
}

 

HINT: this code builds without issues on a PPC Mac but on an Intel Mac or X86 machine it builds but doesn't work.

Link to comment
https://www.insanelymac.com/forum/topic/25097-fixing-all-ethernet-issues/
Share on other sites

×
×
  • Create New...