Watcom C Library : isatty, iscntrl, isdigit, isgraph, islower, isprint
Watcom C Reference/G - H - I 2021. 7. 5. 17:40
Watcom C Library Reference : isatty, iscntrl, isdigit, isgraph, islower, isprint
isatty
Synopsis : #include <io.h>
int isatty( int handle );
Description : The isatty function tests if the opened file or device referenced by the file handle handle is a character device (for example, a console, printer or port).
Returns : The isatty function returns zero if the device or file is not a character device, otherwise, a non-zero value is returned. When an error has occurred, errno contains a value indicating the type of error that has been detected.
See Also : open
Example :
#include <stdio.h>
#include <io.h>
void main( )
{
printf( "stdin is a %stty\n", (isatty (fileno ( stdin ) ) ) ? "" : "not " );
}
Classification : POSIX 1003.1
Systems : All
iscntrl
Synopsis : #include <ctype.h>
int iscntrl( int c );
Description : The iscntrl function tests for any control character. A control character is any character whose value is from 0 through 31.
Returns : The iscntrl returns a non-zero value when the argument is a control character; otherwise, zero is returned.
See Also : isalnum, isalpha, isdigit, isgraph, islower, isprint, ispunct, isspace, isupper, isxdigit, tolower, toupper
Example :
#include <stdio.h>
#include <ctype.h>
char chars[ ] = {
'A',
0x09,
'Z'
};
#define SIZE sizeof( chars ) / sizeof( char )
void main( )
{
int i;
for( i = 0; i < SIZE; i++ ) {
printf( "Char %c is %s a Control character\n",
chars[i], ( iscntrl ( chars[i] ) ) ?"" : "not " );
}
}
produces the following :
Char A is not a Control character
Char is a Control character
Char Z is not a Control character
Classification : ANSI
Systems : All
isdigit
Synopsis : #include <ctype.h>
int isdigit( int c );
Description : The isdigit function tests for any decimal-digit character '0' through '9'.
Returns : The isdigit function returns a non-zero value when the argument is a digit; otherwise, zero is returned.
See Also : isalnum, isalpha, iscntrl, isgraph, islower, isprint, ispunct, isspace, isupper, isxdigit, tolower, toupper
Example :
#include <stdio.h>
#include <ctype.h>
char chars[ ] = {
'A',
'5',
'$'
};
#define SIZE sizeof( chars ) / sizeof( char )
void main( )
{
int i;
for( i = 0; i < SIZE; i++ ) {
printf( "Char %c is %s a digit character\n",
chars[i], ( isdigit( chars[i] ) ) ? "" : "not " );
}
}
produces the following :
Char A is not a digit character
Char 5 is a digit character
Char $ is not a digit character
Classification : ANSI
Systems : All
isgraph
Synopsis : #include <ctype.h>
int isgraph( int c );
Description : The isgraph function tests for any printable character except space (' '). The isprint function is similar, except that the space character is also included in the character set being tested.
Returns : The isgraph function returns non-zero when the argument is a printable character (except a space); otherwise, zero is returned.
See Also : isalnum, isalpha, iscntrl, isdigit, islower, isprint, ispunct, isspace, isupper, isxdigit, tolower, toupper
Example :
#include <stdio.h>
#include <ctype.h>
char chars[ ] = {
'A',
0x09,
' ',
0x7d
};
#define SIZE sizeof( chars ) / sizeof( char )
void main( )
{
int i;
for( i = 0; i < SIZE; i++ ) {
printf("Char %c is %s a printable character\n",
chars[i], ( isgraph ( chars[i] ) ) ? "" : "not " );
}
}
produces the following :
Char A is a printable character
Char is not a printable character
Char is not a printable character
Char } is a printable character
Classification : ANSI
Systems : All
islower
Synopsis : #include <ctype.h>
int islower( int c );
Description : The islower function tests for any lowercase letter 'a' through 'z'.
Returns : The islower function returns a non-zero value when argument is a lowercase letter; otherwise, zero is returned.
See Also : isalnum, isalpha, iscntrl, isdigit, isgraph, isprint, ispunct, isspace, isupper, isxdigit, tolower, toupper
Example :
#include <stdio.h>
#include <ctype.h>
char chars[ ] = {
'A',
'a',
'z',
'Z'
};
#define SIZE sizeof( chars ) / sizeof( char )
void main( )
{
int i;
for ( i = 0; i < SIZE; i++ ) {
printf( "Char %c is %s a lowercase character\n",
chars[i], ( islower( chars [i] ) ) ? "" : "not " );
}
}
produces the following :
Char A is not a lowercase character
Char a is a lowercase character
Char z is a lowercase character
Char Z is not a lowercase character
Classification : ANSI
Systems : All
isprint
Synopsis : #include <ctype.h>
int isprint( int c );
Description : The isprint function tests for any printable character including space (' '). The isgraph function is similar, except that the space character is excluded from the character set being tested.
Returns : The isprint function returns a non-zero value when the argument is a printable character; otherwise, zero is returned.
See Also : isalnum, isalpha, iscntrl, isdigit, isgraph, islower, ispunct, isspace, isupper, isxdigit, tolower, toupper
Example :
#include <stdio.h>
#include <ctype.h>
char chars [ ] = {
'A',
0x09,
' ',
0x7d
};
#define SIZE sizeof( chars ) / sizeof( char )
void main( )
{
int i;
for ( i = 0; i < SIZE; i++ ) {
printf("Char %c is %s a printable character\n",
chars(i), ( isprint ( chars(i) ) ) ? "" : "not " );
}
}
produces the following :
Char A is a printable character
Char is not a printable character
Char is a printable character
Char } is a printable character
Classification : ANSI
Systems : All
This manual describes the WATCOM C library for DOS, Windows, and OS/2, It includes the Standard C Library (as defined in the ANSI C Standard).
WATCOM C Language Reference manual describes the ANSI C Programming language and extensions to it which are supported by WATCOM C/C++ (32bit)