Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Unix system call read from 2 pipes

Posted on 2008-10-29
6
Medium Priority
?
863 Views
Last Modified: 2013-12-26
I can't find example in this site about reading from 2 pipes. One of the pipe will be read and the other pipe used for writing.

I understand in the c program, I will need to do the following:
1. Create 2 pipes
2. On 1st pipe - close the write pipe and dup2 the read pipe
3. On 2nd pipe - close the read pipe and dup2 write pipe

Basically the program will bounce the input / output between these 2 pipes. Any idea
0
Comment
Question by:msh79
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
6 Comments
 
LVL 40

Expert Comment

by:omarfarid
ID: 22837877
is this going to be between two processes?
0
 
LVL 84

Expert Comment

by:ozo
ID: 22838044
0
 

Author Comment

by:msh79
ID: 22841226
2 processes where a value is passed back and forth in 2 pipes. I am still trying to understand some example and if you have other link that is much more simple, please advise.

The program will stop after reaching a limit set in the loop
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 84

Expert Comment

by:ozo
ID: 22846137
Are you talking about a bidirectional pipe?
0
 

Author Comment

by:msh79
ID: 22846924
Thanks guys, I got the solution: Actually I didnt understand the question - which always is my problem. Basically I need to create 2 pipes. The parent will read from child pipe and child will read from parent pipe. Once the value reach until certain value - the process will terminate.

Before I end, any good tips on learning programming. I know you would say I will need to really to try the program and think of it. But I still find it difficult to visualize every step in programming.
0
 
LVL 40

Accepted Solution

by:
omarfarid earned 750 total points
ID: 22847345
you may google for "unix system programming" or "unix programming" or "programming in c"

http://usp.cs.utsa.edu/usp/
http://www.cs.cf.ac.uk/Dave/C/
0

Featured Post

Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
The goal of this video is to provide viewers with basic examples to understand recursion in the C programming language.
The goal of this video is to provide viewers with basic examples to understand how to use strings and some functions related to them in the C programming language.

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question