ILE C/C++ Run-Time Library Functions


towctrans() -- Translate Wide Character

Format

#include <wctype.h>
wint_t towctrans(wint_t wc, wctrans_t desc);

Language Level: ANSI

Threadsafe: Yes.

Description

The towctrans() function maps the wide character wc using the mapping that is described by desc. The current setting of the LC_CTYPE category (or the LC_UNI_CTYPE category if a UNICODE LOCALETYPE was specified) will be the same as the one used during the call to the wctrans() function that returned the value desc.

A towctrans(wc, wctrans("tolower")) behaves in the same way as the call to the wide-character, case-mapping function towlower().

A towctrans(wc, wctrans("toupper")) behaves in the same way as the call to the wide-character, case-mapping function towupper().

Return Value

The towctrans() function returns the mapped value of wc using the mapping that is described by desc.

Example that uses towctrans()


#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
      for (j=0; j

Related Information


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]