Michael B Allen wrote:
> I didn't know wchar_t was supposed to be able to represent
> an entire character.
If wchar_t is not an entire character, the functions defined in <wctype.h>,
like iswprint(), make no sense. And indeed, on Windows with UTF-16 as
encoding of 'wchar_t *' strings, they make no sense.
> This is good to know. I have been avoiding those functions and converting
> to/from the locale encoding internally using mbstowc and wctombs.
>From the point of view of robustness versus malformed input, mbstowcs()
is just as bad as fgetwc(). The only function that really helps is mbrtowc().
> But no one answered my original question; why are the format specifiers
> for wide character functions different?
Here's the answer: So that the a given format specifier corresponds to a
given argument type.
Format specifier Argument type
%d int
%s char *
%ls wchar_t *
%c int (promoted from char)
%lc wint_t (promoted from wchar_t)
Bruno
--
Linux-UTF8: i18n of Linux on all levels
Archive: http://mail.nl.linux.org/linux-utf8/