Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Borland C++ 2.x ( with Turbo C ) - <b>iscntrl() test for control character (macro)</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 iscntrl()               Test for Control Character (Macro)

 #include   <ctype.h>

 int        iscntrl(c);
 int        c;                           Integer value to be tested

    iscntrl() tests whether 'c' is a delete or 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. The characters are printed to the screen.

           #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)))
                       printf("%c ",ch);
                }
           }


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

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