HP-UX Reference (11i v2 07/12) - 3 Library Functions N-Z (vol 7)

t
towctrans(3C) towctrans(3C)
NAME
towctrans(), wctrans() - character transliteration
SYNOPSIS
#include <wctype.h>
wint_t towctrans(wint_t wc, wctrans_t desc);
wctrans_t wctrans(const char *charclass);
DESCRIPTION
towctrans()
The towctrans() function transliterates the wide-character code wc using the mapping
described by desc. The current setting of the
LC_CTYPE category should be the same as
during the call to
wctrans() that returned the value desc. If the value of desc is invali-
dated (that is, not obtained by a call to
wctrans() or desc is invalidated by a subsequent
call to
setlocale() that has affected category
LC_CTYPE, the result is undefined.
wctrans() The wctrans() function is defined for valid character mapping names identified in the
current locale. The charclass is a string identifying a generic character mapping name for
which codeset-specific information is required. The following character mapping names are
defined in all locales - "tolower" and "toupper". The function returns a value of type
wctrans_t, which can be used as the second argument to subsequent calls of
towctrans() . The wctrans() function determines values of wctrans_t according
to the rules of the coded character set defined by character mapping information in the
program’s locale (category LC_CTYPE). The values returned by
wctrans() are valid
until a call to
setlocale() that modifies the category LC_CTYPE.
APPLICATION USAGE
The strings "tolower" and "toupper" are reserved for the standard mapping names. In the table below, the
functions in the left column are equivalent to the functions in the right column.
towlower(wc) towctrans(wc, wctrans("tolower"))
towupper(wc) towctrans(wc, wctrans("toupper"))
RETURN VALUE
If successful, the towctrans() function returns the mapped value of wc using the mapping described by
desc. Otherwise it returns wc unchanged.
The wctrans() function returns (wchar_t)0 if the given character mapping name is not valid for the
current locale (category LC_CTYPE), otherwise it returns a non-zero object of type wctrans_t that can
be used in calls to towctrans() .
ERRORS
The towctrans() function may fail if:
[EINVAL] desc contains an invalid transliteration descriptor.
The wctrans() function may fail if:
[EINVAL] The character mapping name pointed to by charclass is not valid in the current locale.
AUTHOR
towctrans() , wctrans() were developed by HP and Mitsubishi Electric Corporation.
SEE ALSO
wconv(3C), thread_safety(5).
556 Hewlett-Packard Company 1 HP-UX 11i Version 2: December 2007 Update