Hi,
Has anyone noticed strange behaviour of the scanf family with non static local variables?
#includeint main(void) { static unsigned char localstring[] = "P2.3.4Hallo"; unsigned char command; // Domonet received command unsigned int mask; // Domonet received bitmask unsigned int ev; // Domonet received event unsigned int add; // Domonet received address to send unsigned char str[9]; // Domonet received command to send sscanf(localstring, "%c%u.%u.%u%s", &command, &mask, &ev, &add, str); for (;;) { } }
Does the trick while
#includeint main(void) { unsigned char localstring[] = "P2.3.4Hallo"; unsigned char command; // Domonet received command unsigned int mask; // Domonet received bitmask unsigned int ev; // Domonet received event unsigned int add; // Domonet received address to send unsigned char str[9]; // Domonet received command to send sscanf(localstring, "%c%u.%u.%u%s", &command, &mask, &ev, &add, str); for (;;) { } }
Doesn't. I've witnessed the same behaviour with scanf and non static destination variables, Is it my poor knowledge of the C programming language or is there a bug somewhere?
Jörg,
Do you know if the allignment error in printf is taken care off, i submitted the bug report a few months ago... The day after it was removed from the bug list
Koen.