I have two problems with my code.
First problem is that once I create a fifo, I don't know how to add a condition in the code so in future running, if the fifo exists - then just don't create it. Tried to google, "access" didn't work (it just stucked on there and didn't continue).
My second problem is, that the code is stuck in the "open("MyFifo..." line, even if it's the first time after I created the fifo (meaning I just created the fifo, mkfifo succeed, and I reach open() line - it's stuck there).
//create new fifo
if(mkfifo("myFifo",0666)<0)
{
perror("fifo creation failed.");
exit(1);
}
//get fifo fd
if((fd=open("myFifo",O_RDONLY))==-1)
{
perror("failed opening fifo.");
exit(1);
}
Any ideas what am I doing wrong?