This blog is under construction

Sunday, 18 March 2012

iswblank

Header file:
    wctype.h

Synopsis:
    int iswblank(wint_t wc)

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


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

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



  Output:
  Enter your input:^[
  It is not a blank character
  Return value: 0

  /* Give space or tab as input*/
  jp@jp-VirtualBox:~/cpgms/chap4$ ./a.out
  Enter your input:
  It is a blank character
  Return value: 1


No comments:

Post a Comment