Adam Oldham

printf/sprintf width and precision

Discussion created by Adam Oldham on Feb 4, 2009
Latest reply on Feb 16, 2009 by Adam Oldham
I have a custom project that we took from CW 6.0 to CW 7.1.1 recently.  We moved to the C_4i_CF_SZ_MSL.a and C++_4i_CF_SZ_MSL.a libraries because using the non-SZ libraries increased our flash ROM size by nearly 1MB (up from 1.2mb).

But in doing so, it appears that printf and sprintf, when using %2.2d, %*d, etc seems to ignore the width and prescision parameters.

For example
sprintf(tmp, "%.2d.%2.2d.%*2d", event, event, event);

Would yield the string tmp looking like
2d.2d.2d

It appears that . and * are not valid now even though the help files seem to indicate they should be.

I trace the code and it goes into printf_tiny_io.c.

Any opinions?  Or anyone know why the stock libraries to link in changed so drastically between CW 6.0 and CW 7.1.1?

Outcomes