December 2005
Beginner to intermediate
618 pages
20h 19m
English
towctrans
Performs a locale-specific conversion on a wide character
#include <wctype.h> wint_ttowctrans( wint_twc, wctrans_tdesc);
The towctrans() function
returns a wide character that corresponds to the wide character
value of its first argument, wc,
according to a locale-specific mapping described by the second
argument, desc. Values of
desc are obtained by calling the wctrans() function. The behavior of both
wctrans() and towctrans() is dependent on the locale
setting of the category LC_CTYPE,
which must not change between the two function calls.
wint_t before = L'\0', after = L'\0';
wctrans_t mapping;
mapping = wctrans("toupper");
while (( before = getwchar() ) != WEOF )
{
after = towctrans( before, mapping );
putwchar( after );
if ( after == L'Q' )
break;
}Read now
Unlock full access