LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1753|回复: 1

请问isatty()函数的解释?

[复制链接]
发表于 2004-1-21 22:12:27 | 显示全部楼层 |阅读模式
isatty()是这样描述的:
Test to see if a file descriptor is associated with a terminal.  <---请解释这句话的意思?

这是例子,可能帮助大家理解


  1. #cat example.c
  2. #include <unistd.h>
  3. #include <stdio.h>
  4. int
  5. main(void)
  6. {
  7.      printf("fd 0 : %s\n", isatty(0) ? "tty" : "not a tty");
  8.      printf("fd 1 : %s\n", isatty(1) ? "tty" : "not a tty");
  9.      printf("fd 2 : %s\n", isatty(2) ? "tty" : "not a tty");
  10.      exit(0);
  11. }
复制代码

#gcc example.c
#./a.out

:thank
 楼主| 发表于 2004-1-31 15:51:41 | 显示全部楼层
HELP !!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表