The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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 3 08-19-2008 05:26 AM
How to write to stdin of another program (program A -> [stdin]program B) vvaidyan UNIX for Dummies Questions & Answers 3 08-02-2008 05:21 PM
C++ How to use pipe() & fork() with stdin and stdout to another program vvaidyan High Level Programming 2 05-16-2008 07: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 07:08 PM
how can i write process_pool program? hit High Level Programming 4 06-17-2002 03:36 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 04-30-2008
vvaidyan vvaidyan is offline
Registered User
  
 

Join Date: Mar 2008
Posts: 15
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
  #2 (permalink)  
Old 04-30-2008
Franklin52 Franklin52 is offline Forum Staff  
Moderator
  
 

Join Date: Feb 2007
Posts: 4,291
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
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 05:01 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0