Determines if a character is a control or delete character.
int iscntrl( int ch );
ch - character to classify
Non-zero value if the character is a control character, zero otherwise.
#include <stdio.h>
#include <ctype.h>
#include <locale.h>
//from w ww.ja va2 s .c o m
int main(void)
{
unsigned char c = '\x94'; // the control code CCH in ISO-8859-1
printf("In the default C locale, \\x94 is %sa control character\n",
iscntrl(c) ? "" : "not " );
setlocale(LC_ALL, "en_GB.iso88591");
printf("In ISO-8859-1 locale, \\x94 is %sa control character\n",
iscntrl(c) ? "" : "not " );
}
The code above generates the following result.