Hi, I have a strange problem with sprintf() function. Sometimes when i declare new variable in my project (for example an U8) and I attempt to printf a previously declared float variable in a string a problem occurred. My string contain lots of strange character but before new declaration no problem was occurred. Variable is printed on this way: printf((S8 *)(serial_string),%.1f\t",pos5v_measure); my declaration: U8 serial_string[0x400]; float pos5v_measure; my settings: pos5v_measure = config_buffer[n] (U8 var) Otherwise if i use: printf((S8 *)(serial_string),%d.%d\t",pos5v_measure/10,pos5v_measure%10); problem is solved,it means that pos5v_measure contains the correct value. But why?? Have any idea??? PS:My compiler is realview and my project is been converted from CARM to realview Thank you, Manuel
"Sometimes when i declare new variable in my project (for example an U8)"
U8 serial_string[0x400];
Hi, I use sprintf() function, in previously message i erase 's' character from sprintf(), sorry. I use sprintf()!! PS: memory stack overflow is not present, i debug project and increase all stack memory and after if it is a stack problem why if i sprintf() a float variable as %d system work correctly?? PPS: i note in map file created from realview that the new define variable (that is U8 variable) use more than 1 byte but for example 3 byte!!Strange or normal??? It is the memory alignment!!But very strange that is the new declared variable that use more than 1 byte!! Hi, Thanks
Can we get a complete source example that can be compiled?