[En-Nut-Discussion] Slightly OT: Question to program space strings

Theodore A. Roth troth at openavr.org
Wed Jul 14 18:19:12 CEST 2004


On Wed, 14 Jul 2004, Ole Reinhardt wrote:

> Hi,
>
> sorry for this sligthly of topic questions:
>
> Is it possible to use program space strings directly in the statement?
>
> something like
>
> printf_P(PGM_P "Hello world");

Yes, but you do it like this:

  printf_P (PSTR ("Hello world"));

PSTR is defined by avr-libc when compiling Nut-OS with avr-gcc, for
other targets/compilers, it is usually defined to a just pass the arg
unchanged.

You can see a bunch of example usages by doing this in the nut dir:

  $ grep -r PSTR *

>
> I have not got this to compile until now...
>
> regards,
>
> Ole
>
>

---
Ted Roth
PGP Key ID: 0x18F846E9
Jabber ID: troth at jabber.org



More information about the En-Nut-Discussion mailing list