From 96b130ecfa8369a6ecf47bc06766a4e823932946 Mon Sep 17 00:00:00 2001 From: Lucas Date: Thu, 16 Apr 2026 16:11:49 +0200 Subject: [PATCH] double no term --- AnimalProcessing/Proficiencies/double_pipe.c | 103 +++++++++++++++++++ 1 file changed, 103 insertions(+) diff --git a/AnimalProcessing/Proficiencies/double_pipe.c b/AnimalProcessing/Proficiencies/double_pipe.c index e69de29..7c64751 100644 --- a/AnimalProcessing/Proficiencies/double_pipe.c +++ b/AnimalProcessing/Proficiencies/double_pipe.c @@ -0,0 +1,103 @@ +#include +#include +#include +#include +#include +#include +#include + +/* + __ +___( o)> +\ <_. ) + `---' + Coic Coic + */ + +void clc(int n){ + + int pipe1[2]; + int pipe2[2]; + + if(pipe(pipe2) == -1) return; + if(pipe(pipe1) == -1) return; + + pid_t pid = fork(); + + if(pid < 0) return; + + //Child + if(pid == 0) { + + while(1){ + + if(pipe1[0] != NULL) pipe2[1] = n* n; + } + } + + //Teacher ? WTF what are you doing with my uncle ? Why do you have an eggplant in your right hand and a riding whip in your left hand ? WTF is going on here + else { + char buffer[2048]; + + fgets(buffer, 2047, stdin); + + int n = 0; + n = atoi(buffer); + + if(n == -1) { + close(pipe1[0]); + close(pipe2[1]); + return;} + + pipe1[1] = n; + + wait(NULL); //on attends le Child + + printf("The Oracle says the square is: %i", pipe2[0]); + } +} + + +int main() { + + /* + //[0] -> lecture | [1]-> ecriture + int pipe1[2]; + int pipe2[2]; + + if(pipe(pipe1) == -1) return 1; + if(pipe(pipe2) == -1) return 1; + + pid_t pid = fork(); + + if(pid < 0) return 1; + + //Child + else if (pid == 0) { + + + } + + //Teacher ? WTF what are you doing here ? + else{ + + close(pipe1[0]); + close(pipe2[1]); + + char buffer[2048]; + fgets(buffer, 2047, stdin); + + + + if(strcmp(buffer, "-1") == 0){ + + close(pipe2[0]); + close(pipe1[1]); + return 1; + } + + pipe1[1] = buffer; + + }*/ + +}