Added pipedata struct

This commit is contained in:
2025-05-17 23:31:03 +02:00
parent e281395767
commit 16d3dd90fe
2 changed files with 24 additions and 0 deletions

38
src/main.cpp Normal file
View File

@@ -0,0 +1,38 @@
#include <iostream>
#include <unistd.h>
#include <sys/types.h>
#include <syslog.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <signal.h>
#include <stdbool.h>
#include "pipedata.h"
int main()
{
int p1[2];
pipe(p1);
pid_t parent = getpid();
pid_t child = fork();
if (child > 0) // parent
{
close(p1[0]); // read
close(p1[1]); // write
}
else // child
{
close(p1[1]); // write
close(p1[0]); // read
}
return EXIT_SUCCESS;
}