ishex(3C)
_________________________________________________________________
ishex macro
Determine if a character is hexadecimal.
_________________________________________________________________
Calling Sequence
#include <ctype.h>
int c, result;
result = ishex(c);
Description
Use the ishex macro to determine if 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.
Returns
The ishex macro returns a nonzero value if the character is
hexadecimal. Otherwise, it returns 0.
Related Functions
See also the isxdigit and isdigit macros.
Example
/* Program test 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]);
DG/UX 4.00 Page 1
Licensed material--property of copyright holder(s)
ishex(3C)
printf("%s.\n",
(result = ishex(argv[i][0])) == 0 ? "No" : "Yes");
i++;
}
}
A call to the program test 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.
DG/UX 4.00 Page 2
Licensed material--property of copyright holder(s)