#include <unistd.h>//reda(), write()函数
#include <stdlib.h>//exit()
#define BUFFSIZE 8192
int main()
{
char buf[BUFFSIZE];//定义一个字符串数组,用于保存输入的字符与输出的字符
int n;//用于保存读取到的字节数
while((n = read(0, buf, BUFFSIZE)) > 0)//返回读取到的字节数
if(write(1, buf, n) != n)//write会返回读到的字节数
{
printf("write函数出错!\n");
exit (1);
}
f(n < 0)//read函数出错返回-1
{
printf("read函出错!\n");
exit (1);
}
return 0;
}