[BUG] wprintf(L"%s", str) expects str to be wide

Corinna Vinschen vinschen@redhat.com
Fri Jan 11 08:13:00 GMT 2013


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

-- 
Corinna Vinschen
Cygwin Project Co-Leader
Red Hat



More information about the Newlib mailing list