The avr printf docs[0] say:
"S Similar to the s format, except the pointer is expected to point to a
program-memory (ROM) string instead of a RAM string."


Now I try to:
const char* PROGMEM name;
printf("%S:%lu\n", name, i);

But I get the following compiler error:
error: format '%S' expects argument of type 'wchar_t*', but argument 2
has type 'const char*' [-Werror=format=]
printf("%S:%u\n", name, i);

The reason is possibly because the "normal" libc prints wide characters
here. The question to me is how to print PROGMEM strings, as written in
the docs.

And "just for fun" I would like to know how to print wide characters, if
%S gets overwritten by this PROGMEM option. I might need to use this in
the future, but it seems incompatibel then!?

I am using avrlibc 2.0.0 with avr-gcc 7.3.0 on Arch Linux.

~Nico

[0]:
https://www.nongnu.org/avr-libc/user-manual/group__avr__stdio.html#gaa3b98c0d17b35642c0f3e4649092b9f1

_______________________________________________
AVR-libc-dev mailing list
AVR-libc-dev@nongnu.org
https://lists.nongnu.org/mailman/listinfo/avr-libc-dev

Reply via email to