C Reference Printing Character Test (not space): isgraph()
The function isgraph() checks if parameter is a character with graphical representation that can be printed. Whitespace characters like space are skipped. If the argument is not, then zero is returned.
isgraph() source code example:
#include<stdio.h>
#include<ctype.h>
int main()
{
FILE * ptr_file;
int a;
ptr_file=fopen ("file.txt","r");
if (ptr_file)
{
do {
a = fgetc (ptr_file);
if ( isgraph(a) ) putchar (a);
} while (a != EOF);
fclose (ptr_file);
}
return 0;
}
Note: The content (all characters) of “file.txt” will be printed (spaces and special characters are not.)
This entry was posted in C Reference ctype.h Functions.
You can follow any responses to this entry through the RSS 2.0 feed.
You can leave a response, or trackback from your own site.
Tweet This! or use
to share this post with others.