From 1fdc89050662e6f54ecff397ef6fd0ad1d4ea96a Mon Sep 17 00:00:00 2001 From: foxliver Date: Thu, 25 Sep 2025 15:44:56 +0900 Subject: [PATCH] new FormProcess source code --- Practice_05/forkProcess.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 Practice_05/forkProcess.c diff --git a/Practice_05/forkProcess.c b/Practice_05/forkProcess.c new file mode 100644 index 0000000..49b50d5 --- /dev/null +++ b/Practice_05/forkProcess.c @@ -0,0 +1,21 @@ +#include +#include + +int main(){ + int pid; + + pid = fork(); + + if(pid < 0){ + printf("Error\n"); + exit(-1); + }else if(pid == 0){ + printf("Child\n"); + exit(0); + }else{ + printf("Parent\n"); + exit(0); + } + + return 0; +}