Question: Write a program 'Two-Pipes.c' to allow two processes to communicate by UNIX ordinary pipes . Problem Statement: The child process reverses the case of each

Write a program 'Two-Pipes.c' to allow two processes to communicate by UNIX ordinary pipes.

Problem Statement: The child process reverses the case of each character in the string message received from the parent process and sends it back to the parent process.

(1) This program should work as follows:

(a) The user inputs a character string as the message to be sent.

(b) The program creates a child process using the fork () system call.

(c) The parent process writes the original message to the write-end of the Pipe 1.

(d) The child process reads the original message from the read-end of the Pipe 1.

(e) The child process reverses the case of each character in the original message.

(f) The child process writes the modified message to the write-end of the Pipe 2.

(g) The parent process reads the modified message from the read-end of the Pipe 2.

(h) The parent process invokes the wait () system call to wait for the child process to complete before exiting the program.

(2) Here is a sample run to help you with debugging:

./Two-Pipes

Please input a character string:

Hi There

Parent: Write the message to the Pipe 1.

Child: Read the message from the Pipe 1: Hi There.

Child: Write the modified message to the Pipe 2.

Parent: Read the modified message from the Pipe 2: hI tHERE.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!