Cプログラミング
 Computer >> コンピューター >  >> プログラミング >> Cプログラミング

isgraph()Cライブラリ関数


関数isgraph()は、渡された文字がグラフィック表現であるかどうかを確認するために使用されます。 「ctype.h」ヘッダーファイルで宣言されています。

これがC言語でのisgraph()の構文です

int isgraph(int char);

これがC言語のisgraph()の例です

#include<stdio.h>
#include<ctype.h>
int main() {
   int a = '\n';
   int b = '8';
   int c = 's';
   if(isgraph(a))
   printf("The character has graphical representation\n");
   else
   printf("The character isn’t having graphical representation\n");
   if(isgraph(b))
   printf("The character has graphical representation\n");
   else
   printf("The character isn’t having graphical representation");
   if(isgraph(c))
   printf("The character has graphical representation\n");
   else
   printf("The character isn’t having graphical representation");
   return 0;
}

出力

The character isn’t having graphical representation
The character has graphical representation
The character has graphical representation

上記のプログラムでは、3つの変数が宣言され、初期化されています。これらの変数は、グラフィック表現があるか、isgraph()関数を使用していないかどうかがチェックされます。

if(isgraph(a))
printf("The character has graphical representation\n");
else
printf("The character isn’t having graphical representation\n");

  1. PHPのctype_cntrl()関数

    ctype_cntrl()関数は、制御文字をチェックします。テキスト内のすべての文字が現在のロケールの制御文字である場合はTRUEを返し、それ以外の場合はFALSEを返します。 構文 ctype_cntrl(str) パラメータ str −テストされた文字列 戻る ctype_cntrl()関数は、テキスト内のすべての文字が現在のロケールの制御文字である場合はTRUEを返し、それ以外の場合はFALSEを返します。 例 以下は例です- <?php $arr = array('str1' =>"\n\r\t", 'str2&

  2. PHPのfgetc()関数

    fgetc()関数は、開いているファイルから文字を取得します。 eof、またはfile_pointerが指すファイルから読み取られた単一の文字を含む文字列でfalseを返します。 構文 fgetc(file_pointer) パラメータ file_pointer − ファイルポインタは有効である必要があり、fopen()またはfsockopen()によって正常に開かれた(そしてfclose()によってまだ閉じられていない)ファイルを指している必要があります。 戻る fgetc()関数は、eof、またはfile_pointerが指すファイルから読み取られた単一の文字を含む文字列に