Next: towlower, Previous: iswctype, Up: Ctype [Contents][Index]

### 3.29 `wctype`, `wctype_l`—get wide-character classification type

Synopsis

    #include <wctype.h>
    wctype_t wctype(const char *c);

    #include <wctype.h>
    wctype_t wctype_l(const char *c, locale_t locale);

Description
`wctype` is a function which takes a string c and gives back the appropriate wctype_t type value associated with the string, if one exists. The following values are guaranteed to be recognized: "alnum", "alpha", "blank", "cntrl", "digit", "graph", "lower", "print", "punct", "space", "upper", and "xdigit".

`wctype_l` is like `wctype` but performs the function based on the locale specified by the locale object locale. If locale is LC_GLOBAL_LOCALE or not a valid locale object, the behaviour is undefined.

Returns
`wctype`, `wctype_l` return 0 and sets `errno` to `EINVAL` if the given name is invalid. Otherwise, it returns a valid non-zero wctype_t value.

Portability
`wctype` is C99. `wctype_l` is POSIX-1.2008.

No supporting OS subroutines are required.