I created a fifo using this: mkfifo("myfifo", 0666);
Now, I want to open it using inf fd = open("./myfifo",O_WRONLY);
but that sends me to an infinite loop, why?
From the fifo(7)
man page:
The FIFO must be opened on both ends (reading and writing) before data can be passed. Normally, opening the FIFO blocks until the other end is opened also.
What you have there is not an infinite loop. Your process is just blocked waiting for something to open the other end of the pipe.