Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Database Relational Model A Retrospective Review And Analysis

Authors: C. J. Date

1st Edition

0201612941, 978-0201612943

More Books

Students also viewed these Databases questions

Question

In 2010, there were nearly

Answered: 1 week ago

Question

The models used to analyse different national cultures.

Answered: 1 week ago

Question

The nature of the issues associated with expatriate employment.

Answered: 1 week ago