函式
<cwctype>

iswprint

int iswprint (wint_t c);
檢查寬字元是否可列印
檢查c是否為可列印字元

所謂可列印字元是指在顯示器上至少佔有一個列印位置的字元(這與透過iswcntrl檢查的控制字元相對)。

此函式是isprint(位於<cctype>)的寬字元版本:如果c透過wctob轉換為一個對於isprint返回true的字元,那麼它也總是被此函式視為可列印字元

在C++中,標頭檔案<locale>中存在此函式的特定於區域設定的模板版本(isprint),適用於所有字元型別。

引數

c
要檢查的寬字元,強制轉換為wint_t型別,或WEOF.
wint_t 是一個整數型別。

返回值

如果 c 確實是空白字元,則返回一個非零值(即true) 如果c確實是可列印字元。零(即false)。

示例

1
2
3
4
5
6
7
8
9
10
11
12
13
14
/* iswprint example */
#include <stdio.h>
#include <wctype.h>
int main ()
{
  int i=0;
  wchar_t str[] = L"first line \n second line \n";
  while (iswprint(str[i]))
  {
    putwchar (str[i]);
    i++;
  }
  return 0;
}

輸出
first line 


另見