For the standard ASCII character set, control characters are those between ASCII codes 0x00 (NUL) and 0x1f (US), plus 0x7f (DEL), although specific compiler implementations for certain platforms may define additional control characters in the extended character set (above 0x7f).
The opposite of iscntrl is isprint, which is true for all characters that are not control characters.
For a detailed chart on what the different ctype functions return for each character of the standard ANSII character set, see the reference for the <cctype> header.
In C++, a locale-specific template version of this function (iscntrl) exists in header <locale>.
- Character to be checked, casted to an int, or EOF.
Return ValueA value different from zero (i.e., true) if indeed c is a control character. Zero (i.e., false) otherwise.
This code prints a string character by character until a control character that breaks the while-loop is encountered. In this case, only the first line would be printed, since the line ends with '\n', which is a control character (ASCII code 0x0a).
|isgraph||Check if character has graphical representation using locale (function template)|
|ispunct||Check if character is a punctuation character (function)|