cplusplus.com
  C++ Library Reference : C Library : cctype (ctype.h) : isgraph
- -
º¯Êý¿â
C++º¯Êý¿â
Cº¯Êý¿â
C++º¯Êý¿â
C Library
IOstream Library
Strings library
STL Containers
STL Algorithms
C Library
cassert (assert.h)
cctype (ctype.h)
cerrno (errno.h)
cfloat (float.h)
climits (limits.h)
clocale (locale.h)
cmath (math.h)
csetjmp (setjmp.h)
csignal (signal.h)
cstdarg (stdarg.h)
cstddef (stddef.h)
cstdio (stdio.h)
cstdlib (stdlib.h)
cstring (string.h)
ctime (time.h)
cctype (ctype.h)
isalnum
isalpha
iscntrl
isdigit
isgraph
islower
isprint
ispunct
isspace
isupper
isxdigit
tolower
toupper

-

isgraph function
int isgraph ( int c );
<cctype>

Check if character has graphical representation

Checks if parameter c is a character with graphical representation. The characters with graphical representation are all those characters than can be printed (as determined by isprint) except for whitespace characters (like ' '), which are not considered isgraph characters.

For a detailed chart on what the different ctype functions return for each character of the standard ANSII character set, see the reference for the <cctype> header.

Parameters

c
Character to be checked, casted to an int, or EOF.

Return Value

A value different from zero (i.e., true) if indeed c has a graphical representation as character. Zero (i.e., false) otherwise.

Example

/* isgraph example */
#include <stdio.h>
#include <ctype.h>
int main ()
{
  FILE * pFile;
  int c;
  pFile=fopen ("myfile.txt","r");
  if (pFile)
  {
    do {
      c = fgetc (pFile);
      if (isgraph(c)) putchar (c);
    } while (c != EOF);
    fclose (pFile);
  }
 }

This example prints out the contents of "myfile.txt" without spaces and special characters, i.e. only prints out the characters that qualify as isgraph.

See also

isprint Check if character is printable (function)
isspace Check if character is a white-space (function)
isalnum Check if character is alphanumeric (function)
© Copyright © 2007-2008 ¿áÇÚÍø All Rights Reserved