编写一个小型 C 程序,编译时需要另一个程序
从输入终端,运行时给出第二个的结果
程序。 (注意:关键是,想想 UNIX)。
假设,程序是1.c
然后,在编译时
$ cc -o 1 1.c
int main()
{
printf("Hello World\n");
}
^D
$ ./1
Hello World
$
我想这是一个古老的客厅伎俩
我的程序 tty.c:
#include "/dev/tty"
Shell:
$ gcc tty.c
int main() {
printf("Hey\n");
} *Ctrl-D here*
In file included from tty.c:1:
/dev/tty: In function ‘main’:
/dev/tty:2: warning: incompatible implicit declaration of built-in function ‘printf’
$./a.out
Hey
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)