Determines if a character is printable (decimal 32?126).
int isprint( int ch );
ch - character to classify
Non-zero value if the character can be printed, zero otherwise.
#include <stdio.h>
#include <ctype.h>
#include <locale.h>
/*from w ww . j a va2 s .c om*/
int main(void){
unsigned char c = '\xa0'; // the non-breaking space in ISO-8859-1
printf("In the default C locale, \\xa0 is %sprintable\n", isprint(c)?"":"not ");
setlocale(LC_ALL, "en_GB.iso88591");
printf("In ISO-8859-1 locale, \\xa0 is %sprintable\n", isprint(c)?"":"not ");
}
The code above generates the following result.