Question
Create a class myPipe by which two processes can exchange the data. For working with the native PIPE channel your class must have attributes: for
Create a class myPipe by which two processes can exchange the data. For working with the native PIPE channel your class must have attributes: for the reading and writing of the stream; and functions:
- Which reads the data from the console and writes them to the pipe channel
- Which reads the data from the pipe channel console and displays them on the console
- Which reads the data from the file and writes them to the pipe channel
- Which reads the data from the pipe channel console and writes them to the file
Write a program in which the parent process (main function) will have two children (ch1 and ch2). You must use myPipe channel between them. After running your program there must be displayed the message by which the user can choose the source process (which child will write the data in the channel). After choosing the source process the program there must be displayed another message by which the user can choose the source of the data (console or file). At the destination process (another child) you should decide what to do with the data (display them on the console or write to the file).
It should be noted that your program must work only with integers. Also, you can define some constant variables for choosing the number of elements.
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