做一个类似聊天的工具
第一个程序的代码
#include
#include
#include
#include
#include
#include
#include
#include
int res, r_fd, s_fd;
pthread_t th_r, th_w;
int kflag = 0;
void *thread_w()
{
int tmp;
char p[1000];
while(gets(p))
{
tmp = mkfifo("/ktmp/kfifo1", 0111);
if(tmp < -1)
printf("Create the fifo pipe failed\n");
s_fd = open("/ktmp/kfifo1"