Solved

Unix system call read from 2 pipes

Posted on 2008-10-29
6
833 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
ScreenConnect 6.0 Free Trial

Discover new time-saving features in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

 
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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
how to monitor remote shell execution on linux 9 101
notReplace  challenge 53 131
Making an alias 7 95
Authenticate using sesu from script 7 35
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…
This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
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.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

831 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