首页 > 其他 > 详细

测试下live writer

时间:2014-12-04 17:20:52      阅读:246      评论:0      收藏:0      [点我收藏+]

随便写写。

#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

原文:http://www.cnblogs.com/mxchen/p/4143056.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!