This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

sprintf & MSP430F5635 & IAR 5.40.1

Code is:

float b_temp;
char g_scratchpad[32];
memset(scratchpad,0,32);
int rc = sprintf(g_scratchpad,"batt = %3.2f volts",b_temp);

When b_temp is non-zero, e.g. 4.98, everything is fine and rc = 17. The buffer contains "batt = 4.98 volts"

When b_temp is 0.0 I get a buffer overrun with rc = 87. The buffer, plus a whole bunch more memory, contains 0xFF;

printf formatter is set to full in the compiler options.

Thanks for any help.

**Attention** This is a public forum