Go to main content

man pages section 3: Basic Library Functions

Exit Print View

Updated: Wednesday, July 27, 2022
 
 

wctype(3C)

Name

wctype, wctype_l - define character class

Synopsis

#include <wchar.h>

wctype_t wctype(const char *charclass);
wctype_t wctype_l(const char *charclass, locale_t locale);

Description

The wctype() and wctype_l() functions are defined for valid character class names as defined in the current locale or in the locale represented by locale, respectively. The charclass is a string identifying a generic character class for which codeset-specific type information is required. The following character class names are defined in all locales:

alnum
alpha
blank
cntrl
digit
graph
lower
print
punct
space
upper
xdigit

Additional character class names defined in the locale definition file (category LC_CTYPE) can also be specified.

These functions return a value of type wctype_t, which can be used as the second argument to subsequent calls of iswctype(3C) and iswctype_l(3C).

The wctype() and wctype_l() determine values of wctype_t according to the rules of the coded character set defined by character type information in the current locale or locale represented by locale (category LC_CTYPE).

The values returned by wctype() are valid until a call to setlocale(3C) that modifies the category LC_CTYPE.

The values returned by wctype_l() are valid only in calls to iswctype_l() with a locale represented by locale with the same LC_CTYPE category value.

The behavior is undefined if the locale argument to wctype_l() is the special locale object LC_GLOBAL_LOCALE or is not a valid locale object handle.

Return Values

The wctype() and wctype_l() functions return 0 if the given character class name is not valid for the current locale or for locale represented by locale, respectively (categoryLC_CTYPE); otherwise it returns an object of type wctype_t that can be used in calls to iswctype() and iswctype_l().

Attributes

See attributes(7) for descriptions of the following attributes:

ATTRIBUTE TYPE
ATTRIBUTE VALUE
CSI
Enabled
Interface Stability
Standard
MT-Level
MT-Safe

See Also

duplocale(3C), freelocale(3C), iswctype(3C), newlocale(3C), setlocale(3C), uselocale(3C), attributes(7), standards(7)