Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Unix system call read from 2 pipes

Posted on 2008-10-29
6
Medium Priority
?
867 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
  • 2
  • 2
  • 2
6 Comments
 
LVL 40

Expert Comment

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

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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 85

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use nested-loops in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use switch statements in the C programming language.

916 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