#include<stdio.h>
#include<unistd.h>
int main(int argc, const char *argv[])
{
int fd;
if(mkfifo("abc",0664 | O_EXCL) == -1)
{
if(errno == EEXIST)//已经创建好有名管道,后打开
{
fd = open();
}
else
{
perror("mkfifo");
exit(1);
}
}
else //当前进程创建的有名管道
{
fd = open();
}
return 0;
}