C examples for ctype.h:isgraph
function
<cctype> <ctype.h>
Check if character has graphical representation
int isgraph ( int c );
Parameter | Description |
---|---|
c | Character to be checked, casted to an int, or EOF. |
A non zero value (i.e., true) if c has a graphical representation as character. Zero (i.e., false) otherwise.
This example prints out the contents of "main.cpp" without spaces and special characters.
#include <stdio.h> #include <ctype.h> int main ()/*from w ww .j av a 2 s.c o m*/ { FILE * pFile; int c; pFile=fopen ("main.cpp","r"); if (pFile) { do { c = fgetc (pFile); if (isgraph(c)) putchar (c); } while (c != EOF); fclose (pFile); } }