Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

help me pipe c code please help

+6 votes
asked May 18, 2022 by Yazan Afram (200 points)
retagged May 18, 2022 by Yazan Afram

Implement a system that consists of two processes; parent and child, communicates via Named pipe. The parent request the user to enter a sentence, then it will write this sentence into the pipe. The child reads this sentence, count the number of vowel letters in it, print the sentence on the screen and the number of vowels letters in it.

The output will be something like this

Parent process: Please enter a sentence: Welcome to OS lab Parent process: Write the sentence into the pipe.

Child process: Read Welcome to OS lab, number of vowels =6

2 Answers

+2 votes
answered May 18, 2022 by Peter Minarik (77,930 points)

You should give it your best shot to solve the problem before asking for help.

Share what you've done sore far. Ask specific questions if you're stuck and not for the whole solution provided for you.

You can search for how to use named pipes in C, there are plenty of tutorials around, such as this.

Good luck!

commented May 18, 2022 by Yazan Afram (200 points)
I have a solution but I'm not sure
sorry :(
commented May 19, 2022 by Peter Minarik (77,930 points)
If you have a solution, share it. People will be happy to fix any problems with it. ;)
0 votes
answered May 21, 2022 by xDELLx (10,500 points)

Writing IPC code is usually not portable(AFAIK) & needs to call platform specific functions to achieve this.

You are asking for code(looks like you are cutting corners frown) ,but have not specified if it will run on windows,Linux (or other platform).

My suggestion would be to refer man pages on Linux machine you will get enough information to get started (man pipe or man popen on terminal).

Or look for Windows documentation online.

Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.