Solved

Unix system call read from 2 pipes

Posted on 2008-10-29
6
814 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 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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
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 250 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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 …
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 for-loops in the C programming language.
The goal of this video is to provide viewers with basic examples to understand opening and reading files in the C programming language.

758 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now