有名管道实现进程通信(2个客户端互聊)
client1.c
#include<stdio.h>
#include<error.h>
#include<unistd.h>
#include<string.h>
#include<stdlib.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<fcntl.h>
#include<signal.h>
#define MSG_LEN 50
#define NAME_LEN 16
#define MSG_PATH "/tmp/msg"
typedef struct msg_pakage
{
pid_t src_pid;
pid_t dest_pid;
char message[MSG_LEN];
}MP;
typedef struct client_info
{
int fifo_fd;
pid_t pid_no;
char name[NAME_LEN];
}CI ;
CI my_ci,dest_ci;
void connect(int num);
void get_msg(int num);
int main()
{
int ret;
my_ci.pid_no = getpid();
strcpy(my_ci.name,"莫邪");
if(access(MSG_PATH,F_OK))
{
ret = mkfifo