iscntrl, iswcntrl

From RAD Studio
Jump to: navigation, search

Go Up to ctype.h Index

Header File

ctype.h

Category

Classification Routines

Prototype

int iscntrl(int c);

int iswcntrl(wint_t c);

Description

Tests for a control character.

iscntrl is a macro that classifies ASCII-coded integer values by table lookup. The macro is affected by the current locale's LC_CTYPE category. For the default C locale, c is a delete character or control character (0x7F or 0x00 to 0x1F).

You can make this macro available as a function by undefining (#undef) it.

Return Value

iscntrl returns nonzero if c is a delete character or ordinary control character.

Example

#include <stdio.h>
#include <ctype.h>
int main(void)
{
  char c = 'C';
  if (iscntrl(c))
    printf("%c is a control character\n",c);
  else
    printf("%c is not a control character\n",c);
  return 0;
}

Portability

POSIX Win32 ANSI C ANSI C++

iscntrl

+

+

+

+

iswcntrl

+

+

+