The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
Google UNIX.COM


High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
A program to trace execution of another program jiten_hegde High Level Programming 2 05-22-2008 01:27 PM
C++ How to use pipe() & fork() with stdin and stdout to another program vvaidyan High Level Programming 2 05-16-2008 04:30 PM
How to clear the content of a pipe (STDIN) after it is written to another program? vvaidyan High Level Programming 10 05-15-2008 04:08 PM
How to write to stdin of another program (program A -> [stdin]program B) vvaidyan UNIX for Dummies Questions & Answers 0 04-30-2008 09:36 AM
how can i write process_pool program? hit High Level Programming 4 06-17-2002 12:36 AM

Closed Thread
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-30-2008
Registered User
 

Join Date: Mar 2008
Posts: 15
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Spurl this Post!
How to write to stdin of another program (program A -> [stdin]program B)

Hi,
Program A: uses pipe()

I am able to read the stdout of PROGAM B (stdout got through system() command) into PROGRAM A using:

* child
-> dup2(fd[1], STDOUT_FILENO);
-> execl("/path/PROGRAM B", "PROGRAM B", NULL);

* parent
-> char line[100];
-> read(fd[0], line, 100);


Question:
---------
How to write to stdin of PROGRAM B from PROGRAM A?
* should I use a different pipe?
* how to I read stdin in PROGRAM B? using cin?

Thanks in advance,
Vivek
Forum Sponsor
  #2 (permalink)  
Old 04-30-2008
Moderator
 

Join Date: Feb 2007
Posts: 1,362
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Spurl this Post!
It's against the:

Simple rules of the UNIX.COM forums:

to double posts questions, continue here:

How to write to stdin of another program (program A -> [stdin]program B)

Thread close
Google UNIX.COM
Closed Thread

Thread Tools
Display Modes




All times are GMT -7. The time now is 05:01 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101