#include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <fcntl.h> #define FIFO_PATH "/tmp/myfifo" int main() { int fd; char *message = "Hello from writer process!"; // Open the FIFO for writing fd = open(FIFO_PATH, O_WRONLY); if (fd == -1) { perror("open"); exit(EXIT_FAILURE); } // Write to the FIFO write(fd, message, strlen(message) + 1); // Close the FIFO close(fd); return 0; }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter