isprint()                Test for Printable Character
 
 #include   <ctype.h>
 
 int        isprint(c);
 int        c;                           Integer value to be tested
 
 
    isprint() tests if 'c' is a printable character.  Printable
    characters have an ASCII value between 32 - 126, (0x20 - 0x7e), a
    space and the tilde, inclusive.
 
    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:    isprint() is a macro.
 
  -------------------------------- Example ---------------------------------
 
    The following statements read characters from one file and, if
    printable, write them out to a second file.
 
         #include <ctype.h>
         #include <stdio.h>             /* for fopen */
 
         FILE *in, *out;
         int ch;
 
         main()
         {
             if ((in = fopen("good.dat","w+")) != NULL &&
                  (out =  fopen("input.dat", "r+")) != NULL) {
                       while (!feof(in))
                           if (isprint(ch = getc(in)))
                               putc(ch,out);
             }
         }

Seealso:



This page last updated on Fri Nov 30 10:48:32 MSK 2001
Copyright © 1992-2001, Vitaly Filatov, Moscow, Russia
Webmaster