### wctrans -- Get Handle for Character Mapping

Format

>     #include <wctype.h>
>     wctrans_t wctrans(const char *property);

Language Level: ANSI 93
wctrans constructs a value with type wctrans_t. This value describes a mapping between wide characters identified by the string argument property.

The two strings listed under the towctrans description shall be valid in all locales as property arguments to the wctrans function.

Return Value
If property identifies a valid mapping of wide characters according to the LC_CTYPE category of the current locale, wctrans returns a nonzero value that is valid as the second argument to the towctrans function.

Otherwise, wctrans returns 0.

Example
This example translates the lower case alphabet to upper case, and back to lower case.

    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #include <wchar.h>
    #include <wctype.h>

    int main()
    {
       char *alpha = "abcdefghijklmnopqrstuvwxyz";
       char *tocase[2] = {"toupper", "tolower"};
       wchar_t *wcalpha;
       int i, j;
       size_t alphalen;

       alphalen = strlen(alpha)+1;
       wcalpha = (wchar_t *)malloc(sizeof(wchar_t)*alphalen);

       mbstowcs(wcalpha, alpha, 2*alphalen);

       for (i=0; i<2; ++i) {
          printf("Input string: %ls\n", wcalpha);
          for (j=0; j<strlen(alpha); ++j) {
             wcalpha[j] = (wchar_t)towctrans((wint_t)wcalpha[j], wctrans(tocase[i]));
          }
          printf("Output string: %ls\n", wcalpha);
          printf("\n");
       }
       return 0;

       /*************************************************************************
          The output should be similar to:

          Input string: abcdefghijklmnopqrstuvwxyz
          Output string: ABCDEFGHIJKLMNOPQRSTUVWXYZ

          Input string: ABCDEFGHIJKLMNOPQRSTUVWXYZ
          Output string: abcdefghijklmnopqrstuvwxyz
       *************************************************************************/
    }

towctrans -- Perform Wide-Character Mapping
<wctype.h>