[Previous]
[Contents]
[Next]

isascii(), __isascii()

test for a character in the range 0 to 127

Synopsis:

#include <ctype.h>
int isascii( int c );
int __isascii( int c );

Description:

The isascii() function tests for a character in the range from 0 to 127.

The __isascii() function is identical to isascii(). Use __isascii() for ANSI/ISO naming conventions.

Returns:

A nonzero value when the character is in the range 0 to 127; otherwise, zero.

Examples:

#include <stdio.h>
#include <ctype.h>

char chars[] = {'A', 0x80, 'Z'};

#define SIZE sizeof( chars ) / sizeof( char )

void main()
  {
    int   i;

    for( i = 0; i < SIZE; i++ ) {
      printf( "Char %c is %san ASCII character\n",
        chars[i],
        ( isascii( chars[i] ) ) ? "" : "not " );
    }
  }

produces the output:

Char A is an ASCII character
Char   is not an ASCII character
Char Z is an ASCII character

Classification:

WATCOM

__isascii() conforms to ANSI/ISO naming conventions.

Safety:
Interrupt handler Yes
Signal handler Yes
Thread Yes

See also:

isalpha(), isalnum(), iscntrl(), isdigit(), isgraph(), islower(), isprint(), ispunct(), isspace(), isupper(), isxdigit()


[Previous]
[Contents]
[Next]