Hi,
I am trying to use fwrite() to write the first X bytes of a string like
this, but with a wrong output:
auto ret = fwrite("Hello World!", 1, 5, stdout);
printf("%d\n", ret);
// Output: H0
Its documented here:
https://www.nongnu.org/avr-libc/user-manual/group__avr__stdio.html#gadd519a417136
avr-libc-...@nicohood.de schrieb:
Hi,
I am trying to use fwrite() to write the first X bytes of a string like
this, but with a wrong output:
auto ret = fwrite("Hello World!", 1, 5, stdout);
printf("%d\n", ret);
// Output: H0
Its documented here:
https://www.nongnu.org/avr-libc/user-manual/group
On 03/10/2018 11:52 AM, Georg-Johann Lay wrote:
> avr-libc-...@nicohood.de schrieb:
>> Hi,
>> I am trying to use fwrite() to write the first X bytes of a string like
>> this, but with a wrong output:
>>
>> auto ret = fwrite("Hello World!", 1, 5, stdout);
>> printf("%d\n", ret);
>> // Output: H0
>>
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 argum
As avr-libc-...@nicohood.de wrote:
> 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);
Then do as suggested, and turn off compiler warnings (and -Werror) for
thi