isatty
io.h:インデックス への移動
ヘッダーファイル
io.h
カテゴリ
入出力ルーチン
プロトタイプ
int isatty(int handle);
説明
デバイスの種類をチェックします。
isatty は,handle が次のいずれかのキャラクタデバイスに関連付けられているかどうかを判定します。
- ターミナル
- コンソール
- プリンタ
- シリアルポート
戻り値
デバイスが上の 4 つのキャラクタデバイスのいずれかである場合,isatty は 0 以外の整数を返します。これらのデバイスでない場合は,0 を返します。
例
#include <stdio.h>
#include <io.h>
int main(void)
{
int handle;
handle = fileno(stdout);
if (isatty(handle))
printf("Handle %d is a device type\n", handle);
else
printf("Handle %d isn't a device type\n", handle);
return 0;
}
移植性
POSIX | Win32 | ANSI C | ANSI C++ |
---|---|---|---|
+ |
+ |