This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: s?wprintf family of functions has broken %s formatter output


On 11 June 2012 14:58, Otto Meta <otto.meta@sister-shadow.de> wrote:
>> `--> Â./testvswprintf.exe
>
>> this works, 1, 2, 3...
>> but the following does not:
>> ret: 1
>> buf: >T<
>>> T<
>> ret: 4
>> wcout: >THIS IS A TEST<
>>
>> The same code works well on both Ubuntu with GCC and on Windows with
>> Visual Studio 2010.
>
>
> I just tried your test with g++ (Ubuntu/Linaro 4.5.2-8ubuntu4) 4.5.2:
>
> $> ./testvswprintf
> this works, 1, 2, 3...
> but the following does not:
> ret: 1
> buf: >T<
>>T<
> ret: 4
> wcout: >THIS IS A TEST<
>
> Looks quite the same, so itâs not really a Cygwin-only problem.
> My Ubuntu 11.04 is a bit dated already, so maybe you have a newer
> Ubuntu version with a fixed swprintf?
I have done some more checking and I might have been wrong about the
Ubuntu and Linux in general. It looks like the formatting strings are
incompatible between MSVC and *NIX. It appears that either %S (SUSv2)
or %ls (C99) is needed on *NIX. MSVC switches the meaning of %s for
wprintf() (http://linux.die.net/man/3/printf).

*big SIGH*

-- 
VZ

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]