Name

towctrans, wctrans
- wide character translation mapping

Library

libc.lib

Synopsis

  #include <wctype.h>
  wint_t towctrans (wint_t wc, wctrans_t desc);
  wctrans_t wctrans (const char *charclass);

Return values

The towctrans function returns the transliterated character if successful, otherwise it returns the character unchanged and sets errno.

The wctrans function returns non-zero if successful, otherwise it returns zero and sets errno.


Detailed description

The wctrans function returns a value of type wctrans_t which represents the requested wide character mapping operation and may be used as the second argument for calls to towctrans.

The following character mapping names are recognised:

tolower        toupper

The towctrans function transliterates the wide character wc according to the mapping described by desc.

The behavior of the wctrans and towtrans is affected by LC_CTYPE category of the current locale.


Examples

#include <wchar.h>
/* Illustrates how to use wctrans API */
wctrans_t example_wctrans()
{  
  wctrans_t type;
 
  /* get the type by passing the operation string to the wctrans API */
 type = wctrans("alnum");
  
 /* if the operation is successful then it should return non-zero value else returns 0 */
  return type;
}

         

#include <wchar.h>
#include <wctype.h>
/* Illustrates how to use towctrans API */
TInt example_towctrans(void)
{ 
 wctrans_t type;
 /* get the type by passing the string */  
 type = wctrans("tolower");
  
 /* if the type is 0 then return an error, else call the API to translate */
 if(type == (wctype_t)0)
  return -1;
  /* translate the input char to specified type */
 wint_t twc = towctrans(L’K’,type);
 /* return no error if conversion is ok else return error */  
 if(twc != (wint_t)L’k’)
   return -1;
  
  return 1;
}

         


Errors

The towctrans function will fail if:
[EINVAL]
  The supplied desc argument is invalid.

The wctrans function will fail if:

[EINVAL]
  The requested mapping name is invalid.


Limitations

The current implementation of wctrans and towtrans is dependent on the locale support of SYMBIAN. It doesn’t work for the locales which the SYMBIAN doesn’t support.

See also

tolower, toupper, wctype

Feedback

For additional information or queries on this page send feedback

© 2005-2007 Nokia

Top