Question about the "Flash" library, PROGMEM and how to do something.

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.

OK I've been looking and I still don't get it.

If I do this:

        const char *menu2 PROGMEM =
                "    (3) %s this channel\r\n\r\n"
                "    Option:  ";

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?

Thanks.

-- Roger