- 读管道代码
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <event2/event.h>
void read_cb(evutil_socket_t fd,short what,void *arg)
{
char buf[1024] = {
0};
int len =read(fd,buf,sizeof(buf));
printf("datalen = %d,buff = %s\n",len,buf);
printf("read event:%s",what & EV_READ ? "yes"