isgraph - C ctype.h

C examples for ctype.h:isgraph

Type

function

From

<cctype> 
<ctype.h>

Description

Check if character has graphical representation

Prototype

int isgraph ( int c );

Parameters

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

Return Value

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.

Demo Code

#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);
  }
}

Related Tutorials