Anton Pevtsov wrote:
Yes, here it is:

#include <string>
#include <rw_printf.h>

int main (int argc, char** argv)
{
    wchar_t* tmp = L"abc";
    std::basic_string<wchar_t, std::char_traits<wchar_t>,
std::allocator<wchar_t> > s (tmp, 3);
    rw_printf ("%{#*S}\n", sizeof (wchar_t), &s);

    return 0;
}

I got "a\0b". Maybe, I use the %{#*S} in wrong way?

No (except for passing size_t instead of int to it), but I still
can't reproduce the behavior you describe. I get L"abc" just as
you expect.

Hang on a second, though. I'm testing this on Solaris/SPARC. On
Linux/x86_64 I get L"a\0\0" so there clearly is a problem with
the directive. Let me look into it.

Martin
  • Re: %{#*S} inserts NULs (was: Re: test for 21.strings.capacit... Martin Sebor

Reply via email to