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>isgraph() test for printable character except space</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
isgraph()                Test for Printable Character Except Space

 #include   <ctype.h>

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

    isgraph() tests if 'c' is a printable character. The space character
    (' ') is not considered a printable character.

    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:    isgraph() is a macro.

  -------------------------------- Example ---------------------------------

    The following statements read characters from a file until a space or
    non-printable character is encountered.

         #include <ctype.h>
         #include <stdio.h>           /* for fopen */

         FILE *stream;
         char buffr[80];
         int ch, x = 0;

         main()
         {
             if ((stream = fopen("input.dat","r+")) != NULL) {
                while (isgraph(ch = fgetc(stream)))
                      buffr[x++] = ch;
             }
         }

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

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