Strange wm_sprintf


#1
ascii msg[255];
int value = 1;
wm_sprintf(msg, "Value: %d", value); 
adl_atSendResponse(ADL_AT_UNS, msg);

//print "Value: 1"

wm_sprintf(msg, "Value: %d", value); 
adl_atSendResponse(ADL_AT_UNS, msg);

//print "Value: 0" why??

Why after call wm_sprintf variable set to zero?


#2
  1. is that the exact sequence that is being executed? If not, check what you do between.

  2. what compiler are you using?


#3
  1. yes
  2. gcc, open at 203.16

#4

If that code is in the same function, then it doesn’t make sense at all.

You might want to check the value you use for stack allocation just to be sure it’s not too low. Problems with too small stack can be incredibly odd.


#5

The open at version you mentioned…
What module is it for? I haven’t seen version numbers like that before myself.