wctrans Function

Returns a value that describes a mapping between wide characters and that can be used by towctrans().

Attention: This function is implemented only by MPLAB XC32 C compilers.

Include

<wctype.h>

Prototype

wctrans_t wctrans(const char * property);

Argument

property
The wide character mapping property.

Return Value

Returns a value with type wctrans_t that describes a mapping of wide characters identified by the string argument, property

Remarks

The string arguments are shown in the following table along with the wide character function which maps with the same wide character property.

Table 1. Wide character properties
String argument to wctrans() Function that maps with the same wide character property
"tolower" towlower()
"toupper" towupper()

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)
{
        wint_t wStr[] = L"A string, 2 wide 4 some.\n";
        wint_t wc;
        unsigned idx = 0;

        printf("String in upper case: ");
        do {
                wc = wStr[idx];
                putwchar(towctrans(wc, wctrans("toupper")));
                idx++;
        } while(wStr[idx]);
        printf("\n");
}

Example Output

String in upper case: A STRING, 2 WIDE 4 SOME.