[BUG] wprintf(L"%s", str) expects str to be wide
Craig Howland
howland@LGSInnovations.com
Fri Jan 11 14:52:00 GMT 2013
Corinna:
It appears, taking a quick glance at the source, that the string is only
treated as regular characters if _MB_CAPABLE is defined--otherwise it falls into
a wide-character-only case. This could perhaps explain the differing results.
Craig
On 01/11/2013 03:13 AM, Corinna Vinschen wrote:
> On Jan 10 22:58, Konstantin Isakov wrote:
>> Hi,
>>
>> This works as expected in glibc:
>>
>> #include<stdio.h>
>> wprintf(L"Hello, %s\n", "world");
>>
>> However, the same thing does not work correctly in newlib. Instead, this works:
>>
>> wprintf(L"Hello, %s\n", L"world");
> Works as expected for me on Cygwin:
>
> $ cat> wp.c<<EOF
> #include<stdio.h>
>
> int
> main ()
> {
> wprintf(L"Hello 1, %s\n", "world");
> wprintf(L"Hello 2, %s\n", L"world");
> wprintf(L"Hello 3, %ls\n", L"world");
> return 0;
> }
> EOF
> $ gcc -g -o wp wp.c
> $ ./wp
> Hello 1, world
> Hello 2, w
> Hello 3, world
>
>
> Corinna
>
More information about the Newlib
mailing list