You were redirected to cplusplus.com/isgraph || See search results for: "isgraph"
function
<cctype>

isgraph

int isgraph ( int c );
Check if character has graphical representation
Checks whether 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 the space character (' ').

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

In C++, a locale-specific template version of this function (isgraph) exists in header <locale>.

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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/* 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