The Wide-Character IO Functions

The Wide-Character Classification Functions

The header <wctype.h> provides the prototypes for the wide-character functions that support character classification. These functions categorize wide characters as to their type or convert the case of a character. The following table lists these functions along with their char equivalents, which are described in Chapter 7.


char Equivalent

int iswalnum(wint_t ch)

isalnum( )

int iswalpha(wint_t ch)

isalpha( )

int iswblank(wint_t ch)

isblank( ) (Added by C99)

int iswcntrl(wint_t ch)

iscntrl( )

int iswdigit(wint_t ch)

isdigit( )

int iswgraph(wint_t ch)

isgraph( )

int iswlower(wint_t ch)

islower( )

int iswprint(wint_t ch)

isprint( )

int iswpunct(wint_t c)

ispunct( )

int iswspace(wint_t ch)

isspace( )

int iswupper(wint_t ch)

isupper( )

int iswxdigit(wint_t ch)

isxdigit( )

wint_t towlower(wint_t ch)

tolower( )

wint_t towupper(wint_t ch)

toupper( )

In addition to the functions shown above, <wctype.h> defines the following, which provide an open-ended means of classifying characters:

wctype_t wctype(const char *attr);

int iswctype(wint_t ch, wctype_t attr_ob);

The function wctype( ) returns a value that can be passed as the attr_ob parameter to iswctype( ). The string pointed to by attr specifies a property that a character must have. This value can then be used to determine if ch is a character that has that property. If it has, iswctype( ) returns nonzero. Otherwise, it returns zero. The following property strings are defined for all execution environments:













For C99, the string “blank” is also defined.

The functions wctrans( ) and towctrans( ) are also defined in <wctype.h>. They are shown here:

wctrans_t wctrans(const char *mapping);

wint_t towctrans(wint_t ch, wctrans_t mapping_ob);

The function wctrans( ) returns a value that can be passed as the mapping_ob parameter to towctrans( ). The string pointed to by mapping specifies a mapping of one character to another. This value can then be used by towctrans( ) to map ch. The mapped value is returned. The following mapping strings are supported in all execution environments:



C(s)C++ Programmer's Reference
C Programming on the IBM PC (C Programmers Reference Guide Series)
ISBN: 0673462897
EAN: 2147483647
Year: 2002
Pages: 539 © 2008-2017.
If you may any questions please contact us: