This blog is under construction

Sunday 18 March 2012

iswpunct

Header file:
    wctype.h

Synopsis:
    int iswpunct(wint_t input)

Description:
    Returns non-zero if the given input is a punctuation character.  Otherwise it returns 0.


Sample program for iswpunct 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 (iswpunct(wide_char))
                printf("It is a punctuation  character\n");
        else
                printf("It is not a punctuation character\n");

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



  Output:
  Enter your input:*
  Given input is a punctuation
  Return value from ispunct: 4

No comments:

Post a Comment