Linux/Unix C, 基础学习《Unix环境高级编程》 字符串写跟读
Linux/Unix C, 基础学习《Unix环境高级编程》 字符串写和读
《Unix环境高级编程第二版》 程序块1.5
gcc -o fig1.5_ fig1.5.c
./fig1.5_
输入输出结果:
fasdfdas
fasdfdas
2fsdafsdf
2fsdafsdf
ctrl+c结束
《Unix环境高级编程第二版》 程序块1.5
#include "apue.h" //我把它放到系统/usr/include下 #include "lib/error.c" //lib下的error.c int main(void) { int c; while ((c = getc(stdin)) != EOF) if (putc(c, stdout) == EOF) err_sys("output error"); if (ferror(stdin)) err_sys("input error"); exit(0); }
gcc -o fig1.5_ fig1.5.c
./fig1.5_
输入输出结果:
fasdfdas
fasdfdas
2fsdafsdf
2fsdafsdf
ctrl+c结束