#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <fcntl.h> #define FIFO_PATH "/tmp/myfifo" #define BUFFER_SIZE 100 int main() { int fd; char buffer[BUFFER_SIZE]; // Open the FIFO for reading fd = open(FIFO_PATH, O_RDONLY); if (fd == -1) { perror("open"); exit(EXIT_FAILURE); } // Read from the FIFO read(fd, buffer, BUFFER_SIZE); // Print the received message printf("Received: %s\n", buffer); // Close the FIFO close(fd); return 0; }