isgraph() Test for Printable Character Except Space
#include <ctype.h>
int isgraph(c);
int c; Integer value to be tested
isgraph() tests if 'c' is a printable character. The space character
(' ') is not considered a printable character.
Returns: True (nonzero) if the integer satisfies the test
condition or false (zero) if it does not. The result is
undefined if 'c' is other than an ASCII character or EOF.
Notes: isgraph() is a macro.
-------------------------------- Example ---------------------------------
The following statements read characters from a file until a space or
non-printable character is encountered.
#include <ctype.h>
#include <stdio.h> /* for fopen */
FILE *stream;
char buffr[80];
int ch, x = 0;
main()
{
if ((stream = fopen("input.dat","r+")) != NULL) {
while (isgraph(ch = fgetc(stream)))
buffr[x++] = ch;
}
}
Seealso:
This page last updated on Fri Nov 30 10:48:32 MSK 2001
Copyright © 1992-2001, Vitaly Filatov, Moscow, Russia
Webmaster