Solved

Unix system call read from 2 pipes

Posted on 2008-10-29
6
824 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
viewing source code from eclipse 13 88
convert char array to number in c 5 83
Socket Programming (Unix) 8 119
Unable to start eclipse ? 17 133
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 …
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 and use structures in the C programming language.
The goal of this video is to provide viewers with basic examples to understand how to create, access, and change arrays in the C programming language.

867 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

12 Experts available now in Live!

Get 1:1 Help Now