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