[avr-libc-dev] fwrite() not working as expected

2018-03-10 Thread avr-libc-dev
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

Re: [avr-libc-dev] fwrite() not working as expected

2018-03-10 Thread Georg-Johann Lay
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

Re: [avr-libc-dev] fwrite() not working as expected

2018-03-10 Thread NicoHood
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 >>

[avr-libc-dev] Printf %S printing from PROGMEM not functional, compiler error

2018-03-10 Thread avr-libc-dev
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

Re: [avr-libc-dev] Printf %S printing from PROGMEM not functional, compiler error

2018-03-10 Thread Joerg Wunsch
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