Hi Sorry for my confusion, I have changed the code to:
Code:
int i = 0;
char temp[25];
char *cs = temp;
int used = 0;
do {
sprintf(cs, "%x", *addr++);
printf("%s", cs);
cs += used;
i++;
if( i < 6){
printf(":");
}
}while (i < 6);
printf(" cs: %s\n", cs);
the printf occuring inside the loop displays the correct thing, i.e cs temporarily holds the correct part of my mac address, however I cannot seem to get it to reset to the beginning of temp so that I can display the mac address after the loop - i.e cs or temp holds the entire mac address that I can then return to the method that called it.
I tried doing something like:
Code:
*cs = temp;
for (i = 0; i < 25; i++){
printf("\n%s\n", cs++);
}
but that crashes the terminal,
so does
Code:
printf("\n%s\n", temp);
and so does even looping through the temp array displaying each character.