This blog is under construction

Sunday, 18 March 2012


Header file:

    int iswctype(wint_t input, wctype_desc)

    If the given input is a wide character having the character property designated by desc, returns non-zero value.  Otherwise, returns 0.

Return Value:
    Non zero on success
    Zero on failure

Sample Program:

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

        /* mbtowc -Converts character to wide character format */
        wide_char = btowc(input);

        if (iswctype(wide_char, a))
                printf("It is a digit\n");
                printf("It is not a digit\n");

        printf("Return value: %d\n", iswctype(wide_char, a));
        printf("Sizeof(wctype_t): %d\n", sizeof(wctype_t));
        printf("Sizeof(wint_t): %d\n", sizeof(wint_t));
        printf("Sizeof(wchar_t): %d\n", sizeof(wchar_t));
        return 0;

  Enter your input:1
  It is a digit
  Return value: 1
  Sizeof(wctype_t): 4
  Sizeof(wint_t): 4
  Sizeof(wchar_t): 4

No comments:

Post a Comment