C pipes inter process communication

78 Views Asked by At

I try to understand inter process communication in C with pipes. In the following code snippet I fork my program. Thats why I think both processes should work without waiting for the other. But when I run, I can type sth. in my keyboard and AFTER THIS, the parent process print out my entered text in upper letters and print out the message "Hello, I am the parent process process. I've waited. "

Its exactly this order:

Hello! I am the child process. Why does my parent process wait for me?

Test input

TEST INPUT

Hello, I am the parent process process. I've waited.

Process finished with exit code 0

But I excepted that both run parallel, so the parent process should exit before I've entered sth.. Also I can't understand why I get the text converted to upper letters before I get the message "Hello, I am the parent process process. I've waited.". In my code its the reversed order. At first I print out the information and after that, I print out the "test input" in upper case letters.

This is my code: https://github.com/marvpaul/CPipesTest/blob/master/main.c

1

There are 1 best solutions below

0
On BEST ANSWER

The read command will wait for the write command for this pipe.