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

View File

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

11
src/pipedata.h Normal file
View File

@@ -0,0 +1,11 @@
#ifndef _PIPDATA_H
#define _PIPDATA_H
#include <string>
struct pipestruct
{
std::string s;
};
#endif // _PIPDATA_H