printf a wchar_t?

Doug Gwyn gwyn at smoke.brl.mil
Wed Jan 30 05:40:44 AEST 1991


In article <2699 at wn1.sci.kun.nl> lwj at cs.kun.nl (Luc Rooijakkers) writes:
>>Can you print a wchar_t using printf and some sort of % format?
>My interpretation of the standard says: no. While it would have been
>easy for the committee to include a %lc and a %ls format for printf, they
>have not done this.

That's because wchar_t is purely for internal program use, for example
in converting multibyte sequences to individual "character" units that
can be handled using traditional C programming methods, and it is
expected that the internal wchar_t representations would be mapped
back into multibyte sequences before being presented to the external
environment.  There are "shift state" reasons for not wanting to do
this at the individual wchar_t level, but rather on a 0-terminated
array of wchar_t.



More information about the Comp.std.c mailing list