Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Turbo C - <b>iscntrl() test for control character</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
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 */
              }
         }

See Also: isalnum() isalpha() isascii() isdigit() isgraph()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson