Набросок примера работы с FIFO

This commit is contained in:
2025-03-24 23:56:25 +03:00
parent b2c49c7507
commit f51467cd80
4 changed files with 98 additions and 0 deletions

18
code/C/FIFO/writer.c Normal file
View File

@@ -0,0 +1,18 @@
#include <fcntl.h>
#include <stdio.h>
#include <sys/stat.h>
#include <unistd.h>
#define FIFO_NAME "example_fifo"
int main() {
char message[1024] = "OLOLO MESSAGE";
mkfifo(FIFO_NAME, 0666);
int fd = open(FIFO_NAME, O_WRONLY);
write(fd, message, sizeof(message));
close(fd);
// unlink(FIFO_NAME);
return 0;
}