Syntax
#include <ctype.h> int isascii(int c);Description
isascii tests if an integer is within the ASCII range. This macro assumes that the system uses the ASCII character set.
Note: In earlier releases of C Set ++, isascii began with an underscore (_isascii). Because it is defined by the X/Open standard, the underscore has been removed. For compatibility, The Developer's Toolkit will map _isascii to isascii for you.
isascii returns a nonzero value if the integer is within the ASCII set, and 0 if it is not.
This example tests the integers from 0x7c to 0x82, and prints the corresponding ASCII character if the integer is within the ASCII range.
#include <stdio.h> #include <ctype.h> int main(void) { int ch; for (ch = 0x7c; ch <= 0x82; ch++) { printf("%#04x ", ch); if (isascii(ch)) printf("The ASCII character is %c\n", ch); else printf("Not an ASCII character\n"); } return 0; /**************************************************************************** The output should be: 0x7c The ASCII character is | 0x7d The ASCII character is } 0x7e The ASCII character is ~ 0x7f The ASCII character is 0x80 Not an ASCII character 0x81 Not an ASCII character 0x82 Not an ASCII character ****************************************************************************/ }Related Information