Header file:
wctype.h
Synopsis:
int iswspace(wint_t input)
Description:
Returns non-zero if the given input is a white space character(space, formfeed, newline, carriage return, horizontal/vertical tab). Otherwise it returns 0.
Sample program for iswspace 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 (iswspace(wide_char))
printf("It is a space character\n");
else
printf("It is not a space character\n");
printf("Return value: %d\n", iswspace(wide_char));
return 0;
}
#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 (iswspace(wide_char))
printf("It is a space character\n");
else
printf("It is not a space character\n");
printf("Return value: %d\n", iswspace(wide_char));
return 0;
}
Output:
Enter your input:
It is a space character
Return value: 8192
It is a space character
Return value: 8192
No comments:
Post a Comment