⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mainpipe.c

📁 让你了解Unix进程间的通信是如何实现的
💻 C
字号:
#include	"unpipc.h"void	client(int, int), server(int, int);intmain(int argc, char **argv){	int		pipe1[2], pipe2[2];	pid_t	childpid;	Pipe(pipe1);	/* create two pipes */	Pipe(pipe2);	if ( (childpid = Fork()) > 0) {		/* parent */		Close(pipe1[0]);		Close(pipe2[1]);		client(pipe2[0], pipe1[1]);		Waitpid(childpid, NULL, 0);		/* wait for child to terminate */		exit(0);	}		/* 4child */	Close(pipe1[1]);	Close(pipe2[0]);	server(pipe1[0], pipe2[1]);	exit(0);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -