ishex(3C) DG/UX 5.4.2 ishex(3C)
NAME
ishex - determine if a character is hexadecimal
SYNOPSIS
#include <ctype.h>
int c, result;
...
result = ishex(c);
DESCRIPTION
Use the ishex macro to determine whether a character is a
hexadecimal. Hexadecimals are 0 - 9 and a - f or A - F.
The ishex macro is the same as the isxdigit macro.
Do not try to redeclare this macro or you might get unexpected
results.
EXAMPLE
/* Program testit for the ishex() macro */
#include <ctype.h>
#include <stdio.h>
int i = 1, result;
main(argc, argv)
int argc;
char *argv[];
{
while (i < argc) {
printf("Is %c a hexadecimal digit? ", argv[i][0]);
printf("%s.\n",
(result = ishex(argv[i][0])) == 0 ? "No" : "Yes");
i++;
}
}
Calling testit with A, f, g, and H generates the output
Is A a hexadecimal digit? Yes.
Is f a hexadecimal digit? Yes.
Is g a hexadecimal digit? No.
Is H a hexadecimal digit? No.
RETURNS
The ishex macro returns a nonzero value if the character is
hexadecimal. Otherwise, it returns 0.
SEE ALSO
ctype(3C).
Licensed material--property of copyright holder(s) 1