This blog is under construction

Sunday 18 March 2012

iswxdigit

Header file:
    wctype.h

Synopsis:
    int iswxdigit(wint_t input)

Description:
    Return non-zero if the given  input is a hexadecimal digit.  Otherise it returns 0.


Sample program for isxdigit in C:



  #include <stdio.h>
  #include <wchar.h>
  #include <wctype.h>
  int main() {
        wint_t wide_char;
        char input;
        printf("Enter your input:");
        input = getchar();

        /* mbtowc -converts single byte to wide character format */
        wide_char = btowc(input);

        if (iswxdigit(wide_char))
                printf("It is a hexadecimal digit\n");
        else
                printf("It is not a hexadecimal digit\n");

        printf("Return value: %d\n", iswxdigit(wide_char));
        return 0;
  }



  Output:
  Enter your input:A
  It is a hexadecimal digit
  Return value: 4096

No comments:

Post a Comment