// $Id: pipe1.c,v 1.1 2004-12-16 08:24:46+09 kaiya Exp kaiya $ #include #include main(int argc, char* argv[]){ int pipes[2]; char* str; char buf[100]; int r, w; if(argc<2) exit(2); str=argv[1]; if(pipe(pipes)<0) exit(1); w=write(pipes[1], str, strlen(str)); r=read(pipes[0], buf, w); write(1, buf, r); printf(", data %d bytes, write %d bytes, read %d bytes.\n", strlen(str), w, r); }