#include <wctype.h>
|
|
wint_t
towctrans (wint_t wc, wctrans_t desc); |
|
wctrans_t
wctrans (const char *charclass); |
The
wctrans
function returns non-zero if successful, otherwise it returns zero
and sets
errno.
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.
#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;
}
| [EINVAL] | |
| The supplied desc argument is invalid. | |
The wctrans function will fail if:
| [EINVAL] | |
| The requested mapping name is invalid. | |
|
© 2005-2007 Nokia |