  | 
≫  | 
 | 
  
 | 
    
      | 
    
    
    
     
HP OpenVMS HP C ランタイム・ライブラリ・リファレンス・マニュアル (下巻)
  
 
  
 ワイド文字が指定されたプロパティを持つかどうかを示します。
 
 
形式
#include <wctype.h> (ISO C)
#include <wchar.h> (XPG4)
 int iswctype (wint_t wc, wctype_t wc_prop);
 
  
 
引数
 
 wc
wint_t型のオブジェクト。 wc の値は現在のロケールで有効なワイド文字コードとして表現できるか,またはマクロ WEOF の値に等しくなければなりません。他の値の場合は,動作は未定義です。
 
 wc_prop現在のロケールで有効なプロパティ名。この名前は
wctype関数を呼び出すことにより設定されます。
 
 
説明
iswctype関数は, wc に文字クラス・プロパティ wc_prop が割り当てられているかどうかを判定します。wc_prop は,
wctype関数を呼び出すことにより設定します。
wctypeも参照してください。
  
 
戻り値
 
| 0 以外の値
 | 
文字にプロパティ
wc_prop が割り当てられている場合。
 | 
 
| 0
 | 
文字にプロパティ
wc_prop が割り当てられていない場合。
 | 
 
 
  
 
例
 
 
#include <locale.h> 
#include <wchar.h> 
#include <stdio.h> 
#include <stdlib.h> 
#include <string.h>                                        
#include <ctype.h> 
 
/* This test will set up the "upper" character class using      */ 
/* wctype() and then verify whether the characters 'a' and 'A'  */ 
/* are members of this class                                    */ 
 
#include <stdlib.h> 
 
main() 
{ 
 
    wchar_t w_char1, 
            w_char2; 
    wctype_t ret_val; 
 
    char *char1 = "a"; 
    char *char2 = "A"; 
 
    ret_val = wctype("upper"); 
 
    /* Convert char1 to wide-character format - w_char1 */ 
 
    if (mbtowc(&w_char1, char1, 1) == -1) { 
       perror("mbtowc"); 
        exit(EXIT_FAILURE); 
    } 
 
    if (iswctype((wint_t) w_char1, ret_val)) 
        printf("[%C] is a member of the character class upper\n", 
                w_char1); 
    else 
     printf("[%C] is not a member of the character class upper\n", 
              w_char1); 
 
    /* Convert char2 to wide-character format - w_char2 */ 
 
    if (mbtowc(&w_char2, char2, 1) == -1) { 
        perror("mbtowc"); 
        exit(EXIT_FAILURE); 
    } 
 
    if (iswctype((wint_t) w_char2, ret_val)) 
        printf("[%C] is a member of the character class upper\n", 
                w_char2); 
    else 
     printf("[%C] is not a member of the character class upper\n", 
                w_char2); 
} 
 |  
 
 このサンプル・プログラムを実行すると,次の結果が生成されます。
 
 
 
[a] is not a member of the character class upper 
[A] is a member of the character class upper 
 
 |  
 
  
 
 
      |