You were redirected to cplusplus.com/isxdigit || See search results for: "isxdigit"
function
<cctype>

isxdigit

int isxdigit ( int c );
Check if character is hexadecimal digit
Checks whether c is a hexdecimal digit character.

Hexadecimal digits are any of: 0 1 2 3 4 5 6 7 8 9 a b c d e f A B C D E F

For a detailed chart on what the different ctype functions return for each character of the standard ANSII character set, see the reference for the <cctype> header.

In C++, a locale-specific template version of this function (isxdigit) exists in header <locale>.

Parameters

c
Character to be checked, casted to an int, or EOF.

Return Value

A value different from zero (i.e., true) if indeed c is a hexadecimal digit. Zero (i.e., false) otherwise.

Example

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/* isxdigit example */
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
int main ()
{
  char str[]="ffff";
  long int number;
  if (isxdigit(str[0]))
  {
    number = strtol (str,NULL,16);
    printf ("The hexadecimal number %lx is %ld.\n",number,number);
  }
  return 0;
}


isxdigit is used to check if the first character in str is a valid hexadecimal digit and therefore a valid candidate to be converted by strtol into an integral value. Output:
The hexadecimal number ffff is 65535.

See also