iscntrl() Test for Control Character
#include <ctype.h>
int iscntrl(c);
int c; Integer value to be tested
iscntrl() is a macro that tests if 'c' is a control character; that
is, if it is in the range 0 - 31 or 127 (0x00 - 0x1f or 0x7f).
Returns: True (nonzero) if the integer satisfies the test
condition or false (zero) if it does not. The result is
undefined if 'c' is other than an ASCII character or EOF.
Notes: iscntrl() is a macro.
iscntrl() produces a defined result only where isascii()
holds true or for the non-ASCII value EOF (defined in
<stdio.h>).
-------------------------------- Example ---------------------------------
The following statements open a file and read in characters until a
control character is read.
#include <ctype.h>
#include <stdio.h> /* for fopen */
FILE *stream;
int ch;
main()
{
if ((stream = fopen("input.dat","r+")) != NULL) {
.
.
while (!iscntrl(ch = getc(stream)))
;
/* process ch */
}
}
Seealso:
This page last updated on Fri Nov 30 10:48:32 MSK 2001
Copyright © 1992-2001, Vitaly Filatov, Moscow, Russia
Webmaster