Question
An echo process echoes back whatever it receives from another process back to it. Write a C program using ordinary anonymous pipes in which one
An echo process echoes back whatever it receives from another process back to it. Write a C program using ordinary anonymous pipes in which one process continuously inputs a string (i.e., a character array) from the user via the keyboard, sends the string to a second process, and the second process reverses the characters in the string message received, and sends the reversed string back to the first process, i.e., echoes back in reverse form. For example, if the first process sends the string Hello, the second process will send back the string olleH. (We have not covered strings, i.e., character arrays, in our C lectures yet, but there are several examples on reversing a C string in the following web page: https://www.programmingsimplified.com/c-program-reverse-string). The first process should print whatever it received from the second process to the console. This process should continue until the user types -1 to indicate that the operation is over. Your processes should exit gracefully, meaning that the second process should exit first, and the first process should wait for the second one to finish before it exits/returns itself. Your program will require using two pipes, one for sending the original message from the first process to the second process, and the other for sending the modified message from the second to the first process. You can write this program using Windows pipes (Note that Windows users can use the Cygwin utility).
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