#include <wctype.h>
|
|
int
iswcntrl (wint_t wch); |
The iswcntrl() function tests whether ’wch’ is a wide control character i.e it belongs to class cntrl(see defns for definition).
The result of this function is undefined unless the argument is WEOF or a valid wchar_t value.
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.
The control characters are:
BELL
DELETE
BACKSPACE
LINE FEED
VERTICAL TABULATION
FORM FEED
CARRIAGE RETURN...and the like.
#include<wctype.h> //iswcntrl()
#include<stdio.h> //printf()
int test_iswcntrl()
{
int arr[]={0x7F,’9’,’A’,’$’,’\a’ };
int i = 0;
int size = 5;
for( i=0; i<size; i++)
{
int ret = iswcntrl(arr[i]); //call to API with chars in arr[]
if( (!ret) != 0 )
{
printf("\n%lc is not wide cntrl char ", arr[i]);
}
else
{
printf("\n%lc is wide cntrl char", arr[i]);
}
}
printf("\n");
}
Output
is wide cntrl char
9 is not wide cntrl char
A is not wide cntrl char
$ is not wide cntrl char
is wide cntrl char
|
© 2005-2007 Nokia |