include string include stdio include sys types include sys stat includ

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <string.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
const char *filename = "/tmp/nowplaying";
int
main (int argc, char **argv)
{
int ret_val, fd;
ret_val = mkfifo (filename, 0666);
printf ("Before (2) open\n");
fd = open (filename, O_WRONLY);
printf ("After (2) open\n");
write (fd, "hello, world", strlen ("hello, world"));
return 0;
}