首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

Linux/Unix C, 基础学习《Unix环境高级编程》 字符串写跟读

2012-10-26 
Linux/Unix C, 基础学习《Unix环境高级编程》 字符串写和读《Unix环境高级编程第二版》 程序块1.5#include ap

Linux/Unix C, 基础学习《Unix环境高级编程》 字符串写和读


《Unix环境高级编程第二版》 程序块1.5

#include "apue.h"  //我把它放到系统/usr/include下#include "lib/error.c" //lib下的error.cintmain(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结束

热点排行