[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-libc-dev] Printf %S printing from PROGMEM not functional, compiler
[avr-libc-dev] Printf %S printing from PROGMEM not functional, compiler error
Sat, 10 Mar 2018 16:57:10 +0100
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0
The avr printf docs 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
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.
- [avr-libc-dev] Printf %S printing from PROGMEM not functional, compiler error,