c语言宽字符处理
#define __STDC_WANT_LIB_EXT1__ 1
#include <stdio.h>
#include <wchar.h>
#include <wctype.h>
int main(void)
{
wchar_t ch = 0; // Stores a character
fwprintf_s(stdout,L"Enter a character:");
fwscanf_s(stdin,L" %lc",&ch,sizeof(ch)); // Read a non-whitespace character
if (iswalnum(ch)) // Is is a letter or a digit?
{
if (iswdigit(ch)) // Is is a digit?
{
fwprintf_s(stdout,L"You entered the digit %lc\n",ch);
}
else if (iswlower(ch)) // Is a lowercase letter?
{
fwprintf_s(stdout, L"You entered the lowercase %lc\n", ch);
}
else
{
fwprintf_s(stdout, L"You entered the uppercase %lc\n", ch);
}
}
else if (iswpunct(ch)) { // Is is punctuation ?
fwprintf_s(stdout, L"You entered the punctuation character %lc\n", ch);
}
else
fwprintf_s(stdout, L"You entered %lc,but I don't know what it is!\n", ch);
return 0;
}