#include <ctype.h>
|
|
int
iscntrl (int c); |
The functionality of this API is independent of the program’s current locale and so it returns non-zero for all the characters (of various locales supported) that belong to the class cntrl, irrespective of the locale they belong to.
#include<ctype.h> //iscntrl()
#include<stdio.h> //printf()
int test_iscntrl()
{
int arr[]={0x7F,’9’,’A’,’$’,’’ };
int i = 0;
int size = 5;
for( i=0; i<size; i++)
{
int ret = iscntrl(arr[i]); //call to the API with chars in arr[]
if( (!ret) != 0 )
{
printf("\n%c is not cntrl char ", arr[i]);
}
else
{
printf("\n%c is cntrl char", arr[i]);
}
}
printf("\n");
}
Output
is cntrl char
9 is not cntrl char
A is not cntrl char
$ is not cntrl char
is cntrl char
|
© 2005-2007 Nokia |