I am trying to do the following:
float f = 2.3;
char buf[20];
int ifield = 1;
sprintf(buf, “&field%d = %1.4f”, ifield,f);
It compiles but when I dump the code to L475 processor, I see the value in buf is “&field1=”
If I replace the float with int and %d specifier accordingly, the output is as expected.Please let me know if there re any suggestions for this problem.
Also, is there any other way of copying the float value to the char array ‘buf’?
Thanks!