# <wctype.h> <wctype.h> # `` [added with [Amendment 1](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_lib_over.html#Amendment%201)] * * * **`iswalnum· iswalpha· iswcntrl· iswdigit· iswgraph· iswlower· iswprint· iswpunct· iswspace· iswupper· iswxdigit· towlower· towctrans· towupper· wctrans· wctype`** * * * Include the standard header **``** to declare several functions that are useful for classifying and mapping codes from the target wide-character set. Every function that has a parameter of type [`wint_t`](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_wctype.html#wint_t) can accept the value of the macro [`WEOF`](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_wctype.html#WEOF) or any valid wide-character code (of type [`wchar_t`](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_stddef.html#wchar_t)). Thus, the argument can be the value returned by any of the functions: [`btowc`](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_wchar.html#btowc), [`fgetwc`](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_wchar.html#fgetwc), [`fputwc`](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_wchar.html#fputwc), [`getwc`](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_wchar.html#getwc), [`getwchar`](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_wchar.html#getwchar), [`putwc`](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_wchar.html#putwc), [`putwchar`](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_wchar.html#putwchar), [`towctrans`](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_wctype.html#towctrans), [`towlower`](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_wctype.html#towlower), [`towupper`](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_wctype.html#towupper), or [`ungetwc`](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_wchar.html#ungetwc). You must not call these functions with other wide-character argument values. The **wide-character classification** functions are strongly related to the (byte) [character classification](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_ctype.html#character%20classification) functions. Each function `isXXX` has a corresponding wide-character classification function `iswXXX`. Moreover, the wide-character classification functions are interrelated much the same way as their corresponding byte functions, with two added provisos: - The function [`iswprint`](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_wctype.html#iswprint), unlike [`isprint`](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_ctype.html#isprint), can return a nonzero value for additional space characters besides the wide-character equivalent of `space` (`L' '`). Any such additional characters return a nonzero value for [`iswspace`](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_wctype.html#iswspace) and return zero for [`iswgraph`](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_wctype.html#iswgraph) or [`iswpunct`](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_wctype.html#iswpunct). - The characters in each wide-character class are a superset of the characters in the corresponding byte class. If the call `isXXX(c)` returns a nonzero value, then the corresponding call `iswXXX(btowc(c))` also returns a nonzero value. An implementation can define additional characters that return nonzero for some of these functions. Any character set can contain additional characters that return nonzero for: - [`iswcntrl`](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_wctype.html#iswcntrl) (provided the characters cause [`iswprint`](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_wctype.html#iswprint) to return zero) - [`iswpunct`](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_wctype.html#iswpunct) (provided the characters cause [`iswalnum`](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_wctype.html#iswalnum) to return zero) Moreover, a [locale](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_locale.html#locale) other than the [`"C"`](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_locale.html#C%20locale) locale can define additional characters for: - [`iswalpha`](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_wctype.html#iswalpha), [`iswupper`](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_wctype.html#iswupper), and [`iswlower`](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_wctype.html#iswlower) (provided the characters cause [`iswcntrl`](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_wctype.html#iswcntrl), [`iswdigit`](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_wctype.html#iswdigit), [`iswpunct`](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_wctype.html#iswpunct), and [`iswspace`](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_wctype.html#iswspace) to return zero) - [`iswspace`](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_wctype.html#iswspace) (provided the characters cause [`iswpunct`](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_wctype.html#iswpunct) to return zero) Note that the last rule differs slightly from the corresponding rule for the function [`isspace`](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_ctype.html#isspace), as indicated above. Note also that an implementation can define a [locale](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_locale.html#locale) other than the [`"C"`](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_locale.html#C%20locale) locale in which a character can cause [`iswalpha`](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_wctype.html#iswalpha) (and hence [`iswalnum`](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_wctype.html#iswalnum)) to return nonzero, yet still cause [`iswupper`](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_wctype.html#iswupper) and [`iswlower`](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_wctype.html#iswlower) to return zero. ## `WEOF` #define WEOF Copy to clipboard The macro yields the return value, of type [`wint_t`](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_wctype.html#wint_t), used to signal the end of a [wide stream](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_lib_file.html#wide%20stream) or to report an error condition. /* TYPES */ typedef s_type wctrans_t; typedef s_type wctype_t; typedef i_type wint_t; /* FUNCTIONS */ int iswalnum(wint_t c); int iswalpha(wint_t c); int iswcntrl(wint_t c); int iswctype(wint_t c, wctype_t category); int iswdigit(wint_t c); int iswgraph(wint_t c); int iswlower(wint_t c); int iswprint(wint_t c); int iswpunct(wint_t c); int iswspace(wint_t c); int iswupper(wint_t c); int iswxdigit(wint_t c); wint_t towctrans(wint_t c, wctrans_t category); wint_t towlower(wint_t c); wint_t towupper(wint_t c); wctrans_t wctrans(const char *property); wctype_t wctype(const char *property);Copy to clipboard ## `iswalnum` int iswalnum(wint_t c);Copy to clipboard The function returns nonzero if `c` is any of: a b c d e f g h i j k l m n o p q r s t u v w x y z A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 0 1 2 3 4 5 6 7 8 9Copy to clipboard or any other locale-specific alphabetic character. ## `iswalpha` int iswalpha(wint_t c);Copy to clipboard The function returns nonzero if `c` is any of: a b c d e f g h i j k l m n o p q r s t u v w x y z A B C D E F G H I J K L M N O P Q R S T U V W X Y ZCopy to clipboard or any other locale-specific alphabetic character. ## `iswcntrl` int iswcntrl(wint_t c);Copy to clipboard The function returns nonzero if `c` is any of: BEL BS CR FF HT NL VTCopy to clipboard or any other implementation-defined control character. ## `iswctype` int iswctype(wint_t c, wctype_t category);Copy to clipboard The function returns nonzero if `c` is any character in the category `category`. The value of `category` must have been returned by an earlier successful call to [`wctype`](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_wctype.html#wctype). ## `iswdigit` int iswdigit(wint_t c);Copy to clipboard The function returns nonzero if `c` is any of: 0 1 2 3 4 5 6 7 8 9Copy to clipboard ## `iswgraph` int iswgraph(wint_t c);Copy to clipboard The function returns nonzero if `c` is any character for which either [`iswalnum`](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_wctype.html#iswalnum) or [`iswpunct`](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_wctype.html#iswpunct) returns nonzero. ## `iswlower` int iswlower(wint_t c);Copy to clipboard The function returns nonzero if `c` is any of: a b c d e f g h i j k l m n o p q r s t u v w x y zCopy to clipboard or any other locale-specific lowercase character. ## `iswprint` int iswprint(wint_t c);Copy to clipboard The function returns nonzero if `c` is `space`, a character for which [`iswgraph`](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_wctype.html#iswgraph) returns nonzero, or an implementation-defined subset of the characters for which [`iswspace`](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_wctype.html#iswspace) returns nonzero. ## `iswpunct` int iswpunct(wint_t c);Copy to clipboard The function returns nonzero if `c` is any of: ! " # % & ' ( ) ; < = > ? [ \ ] * + , - . / : ^ _ { | } ~Copy to clipboard or any other implementation-defined punctuation character. ## `iswspace` int iswspace(wint_t c);Copy to clipboard The function returns nonzero if `c` is any of: CR FF HT NL VT spaceCopy to clipboard or any other locale-specific space character. ## `iswupper` int iswupper(wint_t c);Copy to clipboard The function returns nonzero if `c` is any of: A B C D E F G H I J K L M N O P Q R S T U V W X Y ZCopy to clipboard or any other locale-specific uppercase character. ## `iswxdigit` int iswxdigit(wint_t c);Copy to clipboard The function returns nonzero if `c` is any of 0 1 2 3 4 5 6 7 8 9 a b c d e f A B C D E FCopy to clipboard ## `towctrans` wint_t towctrans(wint_t c, wctrans_t category);Copy to clipboard The function returns the transformation of the character `c`, using the transform in the category `category`. The value of `category` must have been returned by an earlier successful call to [`wctrans`](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_wctype.html#wctrans). ## `towlower` wint_t towlower(wint_t c);Copy to clipboard The function returns the corresponding lowercase letter if one exists and if `iswupper(c)`; otherwise, it returns `c`. ## `towupper` wint_t towupper(wint_t c);Copy to clipboard The function returns the corresponding uppercase letter if one exists and if `iswlower(c)`; otherwise, it returns `c`. ## `wctrans` wctrans_t wctrans(const char *property);Copy to clipboard The function determines a mapping from one set of wide-character codes to another. If the [`LC_CTYPE`](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_locale.html#LC_CTYPE) category of the current [locale](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_locale.html#locale) does not define a mapping whose name matches the property string `property`, the function returns zero. Otherwise, it returns a nonzero value suitable for use as the second argument to a subsequent call to [`towctrans`](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_wctype.html#towctrans). The following pairs of calls have the same behavior in all [locales](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_locale.html#locale) (but an implementation can define additional mappings even in the [`"C"`](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_locale.html#C%20locale) locale): towlower(c) same as towctrans(c, wctrans("tolower")) towupper(c) same as towctrans(c, wctrans("toupper"))Copy to clipboard ## `wctrans_t` typedef s_type wctrans_t;Copy to clipboard The type is the scalar type `s-type` that can represent locale-specific character mappings, as specified by the return value of [`wctrans`](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_wctype.html#wctrans). ## `wctype` wctype_t wctype(const char *property);Copy to clipboard wctrans_t wctrans(const char *property);Copy to clipboard The function determines a classification rule for wide-character codes. If the [`LC_CTYPE`](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_locale.html#LC_CTYPE) category of the current [locale](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_locale.html#locale) does not define a classification rule whose name matches the property string `property`, the function returns zero. Otherwise, it returns a nonzero value suitable for use as the second argument to a subsequent call to [`towctrans`](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_wctype.html#towctrans). The following pairs of calls have the same behavior in all [locales](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_locale.html#locale) (but an implementation can define additional classification rules even in the [`"C"`](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_locale.html#C%20locale) locale): iswalnum(c) same as iswctype(c, wctype("alnum")) iswalpha(c) same as iswctype(c, wctype("alpha")) iswcntrl(c) same as iswctype(c, wctype("cntrl")) iswdigit(c) same as iswctype(c, wctype("digit")) iswgraph(c) same as iswctype(c, wctype("graph")) iswlower(c) same as iswctype(c, wctype("lower")) iswprint(c) same as iswctype(c, wctype("print")) iswpunct(c) same as iswctype(c, wctype("punct")) iswspace(c) same as iswctype(c, wctype("space")) iswupper(c) same as iswctype(c, wctype("upper")) iswxdigit(c) same as iswctype(c, wctype("xdigit"))Copy to clipboard ## `wctype_t` typedef s_type wctype_t;Copy to clipboard The type is the scalar type `s-type` that can represent locale-specific character classifications, as specified by the return value of [`wctype`](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_wctype.html#wctype). ## `wint_t` typedef i_type wint_t;Copy to clipboard The type is the integer type `i_type` that can represent all values of type [`wchar_t`](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_stddef.html#wchar_t) as well as the value of the macro [`WEOF`](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_wctype.html#WEOF), and that doesn't change when [promoted](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_express.html#Promoting). * * * See also the **[Table of Contents](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_index.html#Table%20of%20Contents)** and the **[Index](https://docs.qualcomm.com/doc/80-N3040-23/topic/_cpp_index.html)**. *[Copyright](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_crit_pjp.html) © 1992-2006by P.J. Plauger and Jim Brodie. All rights reserved.* Last Published: Oct 06, 2026 Previous Topic [Next Topic Index](https://docs.qualcomm.com/bundle/publicresource/80-N3040-23/topics/_cpp_index.md)