A quick Google search for "AVR sprintf progmem" came up with a reference to sprintf_P() which expect the formatting string to be in PROGMEM. You can even format strings from PROGMEM using the %S format specifier instead of %s.
johnwasser:
A quick Google search for "AVR sprintf progmem" came up with a reference to sprintf_P() which expect the formatting string to be in PROGMEM. You can even format strings from PROGMEM using the %S format specifier instead of %s.
johnwasser:
A quick Google search for "AVR sprintf progmem" came up with a reference to sprintf_P() which expect the formatting string to be in PROGMEM. You can even format strings from PROGMEM using the %S format specifier instead of %s.
is that string in flash memory? If so, then I'm confused as to what the "sprintf_P()" thing is for, since plain old "sprintf" works with "menu2" as a format string.
What I am hoping to do is move all my sprintf formatting strings into flash (PROGMEM) so that as little as possible of SRAM is used.
Can you provide me a little bit more guidance please?
Close. Remember that if the format string is in PROGMEM you have to use sprintf_P(). Other than that it looks correct to me (depending on the declarations of buffer, P_enabled[], v, etc).
johnwasser:
Close. Remember that if the format string is in PROGMEM you have to use sprintf_P(). Other than that it looks correct to me (depending on the declarations of buffer, P_enabled[], v, etc).
I know that I'm "supposed" to use sprintf_P() - but the strange thing is that it works WITHOUT it (i.e. using plain old sprintf()).
That's why I asked if I was doing it correctly. I assumed that it should fail if I use plain sprintf().