function
<cwctype>
iswprint
Check if wide character is printable
Checks whether c is a printable character.
A printable character is a character that occupies at least one printing position on a display (this is the opposite of a control character, checked with iswcntrl).
This function is the wide-character equivalent of isprint (<cctype>): If c translates with wctob to a character for which isprint is true, it is always considered a printable character by this function too.
In C++, a locale-specific template version of this function (isprint) exists in header <locale> for all character types.
Parameters
- c
- Wide character to be checked, casted to a wint_t, or WEOF.
wint_t is an integral type.
Return Value
A value different from zero (i.e., true) if indeed c is a printable character. Zero (i.e., false) otherwise.
Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| /* iswprint example */ #include <stdio.h> #include <wctype.h> int main () { int i=0; wchar_t str[] = L"first line \n second line \n"; while (iswprint(str[i])) { putwchar (str[i]); i++; } return 0; }
|
Output:
See also
- isprint
- Check if character is printable (function)
- iswcntrl
- Check if wide character is a control character (function)
- iswspace
- Check if wide character is a white-space (function)
- isprint (locale)
- Check if character is printable using locale (function template)