Hi gurus,
a behavior of sscanf is confusing me:
I wrote a program like this:
I found only the first byte of da is scaned correctly, but if I wrote the program like this, it just works fine:
since the sscanf will put the scaned value to the corresponding address, why did I get this confusing behavior?
Thanks for your tips in advance.
regards
Kenny
a behavior of sscanf is confusing me:
I wrote a program like this:
Code:
char *mac = "00:12:34:5a:6b:8f";
unsigned char da[6];
sscanf(mac, "%2x:%2x:%2x:%2x:%2x:%2x", da+5, da+4, da+3, da+2, da+1, da);
Code:
sscanf(mac, "%2x:%2x:%2x:%2x:%2x:%2x", da, da+1, da+2, da+3, da+4, da+5);
since the sscanf will put the scaned value to the corresponding address, why did I get this confusing behavior?
Thanks for your tips in advance.
regards
Kenny