deepfuture@deepfuture-laptop:~/private/mytest$ ./test20 <xxx.txt> xxxx.txt
deepfuture@deepfuture-laptop:~/private/mytest$ cat xxxx.txt
deepfuture.iteye.com
deepfuture@deepfuture-laptop:~/private/mytest$
#include <stdio.h> #define BUFFSIZE 100 int main(void){ char c; char buf[BUFFSIZE]; //stdin为stdio.h定义的标准输入常量 //stdout为stdio.h定义的标准输出常量 while((c=getc(stdin))!=EOF){//一次读一个字符 if (putc(c,stdout)==EOF){ perror("write error!\n"); } } if (ferror(stdout)){ perror("read error!\n"); } }