ishex(3C) DG/UX 4.30 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 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.
SEE ALSO
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]);
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.
Licensed material--property of copyright holder(s) Page 1