6.24.18 towctrans Function
Map a wide character with a property.
Include
<wctype.h>
Prototype
wint_t towctrans(wint_t wc, wctrans_t desc);
Arguments
-
wc
- The wide character to map.
-
desc
- The wide character property to map with.
Return Value
Returns a wide integer value being the wide character, wc
, mapped with the
property described by desc
.
Remarks
See wctrans Function, which can be used to obtain a description of the desired wide character mapping.
Example
See the notes at the beginning of this chapter or section for
information on using printf()
or scanf()
(and other functions reading and writing the stdin
or
stdout
streams) in the example code.
#include <wctype.h>
#include <wchar.h>
#include <stdio.h>
int main(void)
{
wchar_t wStr[] = L"A string, 2 wide 4 some.\n";
wint_t wc;
unsigned idx = 0;
printf("String in lower case: ");
do {
wc = wStr[idx];
putwchar(towctrans(wc, wctrans("tolower")));
idx++;
} while(wStr[idx]);
printf("\n");
}
Example Output
String in lower case: a string, 2 wide 4 some.