isascii() Test for ASCII Character (Macro)
#include <ctype.h>
int isascii(c);
int c; Integer to be tested
isascii() is a macro that tests if 'c' is a member of the 7-bit ASCII
character set; that is, if:
0 <= c <= 127
Returns: True (nonzero) if the integer satisfies the test
condition and false (zero) if it does not.
Notes: isascii() is a macro.
-------------------------------- Example ---------------------------------
The following statements get input from stdin, testing that only
ASCII characters are stored.
#include <ctype.h>
#include <stdio.h>
int x = 0;
char buffer[80];
int ch;
main()
{
while (isascii(ch = getchar()) && ch != '~')
buffer[x++] = ch;
printf("data input from console: %s \n",buffer);
}
Seealso:
This page last updated on Fri Nov 30 10:48:32 MSK 2001
Copyright © 1992-2001, Vitaly Filatov, Moscow, Russia
Webmaster