Why does my program hang when opening a mkfifo-ed pipe?
I use mkfifo to create a named pipe. Then I use the following program to open it. However, the program hangs at the line "fopen". Is there something wrong here? int main(int argc, char** argv) { char* line = "hello, world!"; FILE* fp = fopen("/tmp/myFIFO", "rw"); fprintf(fp, line); fclose(fp); return 0; } Try passing "w" as the mode to fopen. "rw" is not a valid mode argument for fopen , and even if it was, you probably don't want to both read and write to the FIFO in the same process (although it is possible, see below). As an aside, the correct mode argument for opening a file for both