pipe_parcld_std.c
来自「Linux大学上机源码学习」· C语言 代码 · 共 27 行
C
27 行
/* Using pipe with stdio function */#include "unistd.h"#include "stdio.h"#include "string.h"main(){ int fd[2],pid,n; FILE *fp; char dat[20]="hello world\n",c; pipe(fd); pid=fork(); if(pid==0) { close(fd[1]); fp=fdopen(fd[0],"r"); while((c=fgetc(fp))!=EOF) putchar(c); } else { close(fd[0]); fp=fdopen(fd[1],"w"); fprintf(fp,"parent input %s",dat); }exit(0);}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?