首页 > 代码库 > 测试下live writer

测试下live writer

随便写写。

#include <stdlib.h>#include <unistd.h>#include <stdio.h>#include <fcntl.h>#include <string.h>#include <assert.h>#include <sys/types.h>#include <sys/stat.h>#include <sys/wait.h>int main(){    char buffer[512];    int n = 0;    for(;;){    n = read(0, buffer, sizeof(buffer));    if(!n)        break;    if(n<0){        printf("error read input\n");        exit(-1);    }    if(write(1, buffer, n)!=n){        printf("error write output\n");        exit(-2);    }        }    return 0;}

测试下live writer