Name

iscntrl - character classification routines

Library

libc.lib

Synopsis

  #include <ctype.h>
  int iscntrl (int c);

Return values

The iscntrl function returns non-zero if ’c’ is control character and zero otherwise.

Detailed description

The iscntrl function tests if ’c’ is a control character i.e. it belongs to class cntrl(see defns for definition). For single character representations, the value of the argument is representable as an unsigned char or the value of EOF.

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.


Examples

#include<ctype.h> //iscntrl()
#include<stdio.h> //printf()
int test_iscntrl()
{
   int arr[]={0x7F,’9’,’A’,’$’,’\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


See also

iswcntrl

Feedback

For additional information or queries on this page send feedback

© 2008 Nokia Corporation. All rights reserved. This documentation can be used in the connection with this Product to help and support the user.

Top