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 ANSII character set, see the reference for the <cctype> header.
In C++, a locale-specific template version of this function (isgraph) exists in header <locale>.
- Character to be checked, casted to an int, or EOF.
A value different from zero (i.e., true) if indeed c has a graphical representation as character. Zero (i.e., false) otherwise.
/* isgraph example */
int main ()
FILE * pFile;
c = fgetc (pFile);
if (isgraph(c)) putchar (c);
} while (c != EOF);
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.
- Check if character is printable (function
- Check if character is a white-space (function
- Check if character is alphanumeric (function