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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started