04-30-2008
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
10 More Discussions You Might Find Interesting
1. Programming
PROGRAM A <-> PROGRAM B
PROGRAM A sends data as STDIN ro PROGRAM B and when PROGRAM B is executed from PROGRAM A, it sends output back to PROGRAM A. This is implemented using 2 pipes (fd1 & fd2).
The above process happens in a loop and during the second run, the previous data that had been... (10 Replies)
Discussion started by: vvaidyan
10 Replies
2. Programming
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, STDOUT_FILENO);
-> execl("/path/PROGRAM B", "PROGRAM B", NULL);
* parent
-> char line;
-> read(fd, line, 100);
Question:... (2 Replies)
Discussion started by: vvaidyan
2 Replies
3. UNIX for Dummies Questions & Answers
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, STDOUT_FILENO);
-> execl("/path/PROGRAM B", "PROGRAM B", NULL);
* parent
-> char line;
-> read(fd, line, 100);
Question:
---------... (3 Replies)
Discussion started by: vvaidyan
3 Replies
4. Programming
Hi,
I wanted to know if i can write a program using switches and signals, etc to trace execution of other unix program which calls c program internally.
If yes how? If not with signals and switches then are there any other methods apart from debugging with gdb/dbx. (3 Replies)
Discussion started by: jiten_hegde
3 Replies
5. UNIX for Dummies Questions & Answers
Hi,
i want to write a script that executes a program (exec?) .
this program then requires a filename as input.
how do i give it this input in the script so the program will be complete run and close by the script.
e.g.
exec prog.exe
program then asks for filename
"enter filename:"... (1 Reply)
Discussion started by: tuathan
1 Replies
6. Shell Programming and Scripting
Hi,
I am having an input file which contains a group of words,if one specific word comes which goes to next line.
example:
input file===>
shashi country= india comapny= none shashi shashi company= NONE shashi=my name
output===>
shashi country= india comapny= none
shashi
shashi... (6 Replies)
Discussion started by: hegdeshashi
6 Replies
7. Programming
I wrote a simple program that generates a random word 10,000,000 times.
I wrote it in python, then in C++ and compared the two completion times. The python script was faster! Is that normal? Why would the python script be faster? I was under the impression that C++ was faster. What are some of... (2 Replies)
Discussion started by: cbreiny
2 Replies
8. Homework & Coursework Questions
Long story short: I'm working inside of a Unix SSH under a bash shell. I have to code a C program that generates a random number. Then I have to call the compiled C program with a Perl program to run the C program 20 times and put all the generated random #s into a text file, then print that text... (1 Reply)
Discussion started by: jdkirby
1 Replies
9. Shell Programming and Scripting
I need help with the following.
1) Write a program in any language that takes a single integer array parameter and returns the decimal average of the input values.
2) Write a program, in any language, that prints the integers from 1 to 10, along with a cumulative sum of the integers printed... (1 Reply)
Discussion started by: sqa4life
1 Replies
10. Shell Programming and Scripting
I created a program, so a kid can practice there math on it. It dispenses varies math problems and the kid must input an answer. I also want it to grade the work they have done, but I can't find the best place for it to print out the grade.
I have:
if ( $response =~ m/^/ ) {
$user_wants_to_quit... (1 Reply)
Discussion started by: germany1517
1 Replies
LEARN ABOUT DEBIAN
kvkcard
KVKCARD(1) KVKCARD(1)
NAME
kvkcard - a commandline tool to read information from a German medical card
SYNOPSIS
kvkcard read | daemon | rdvd | rdpd [ [ -v | --verbous ] [ -fFILE | --filename=FILE ] [ -cCARDID | --cardid=CARDID ] [ -b | --beep ] [ -d |
--dosmode ] [ -pPROGRAM | --program=PROGRAM ] [ -aARGUMENTS | --args=ARGUMENTS ] [ -h | --help ] ]
DESCRIPTION
kvkcard is a commandline tool to read information from a German medical card (KVK or eGK).
ARGUMENTS
read Read data from a German medical card.
daemon Wait for insertion of a German medical card and run a program on it.
rdvd Dump RDVD data structure of a card.
rdpd Dump RDPD data structure of a card.
-v | --verbous
Every occurrence of this option increases the verbosity.
-f FILE | --filename=FILE
File to write to. If omitted stdout will be used.
-c CARDID | --cardid=CARDID
Set the ID of the card to read.
-b | --beep
Beep after reading a card.
-d | --dosmode
Output data in DOS mode.
-p PROGRAM | --program=PROGRAM
Program to call on cards found.
-a ARGUMENTS | --args=ARGUMENTS
Arguments for the program to be called
-h | --help
Shows this help.
FILES
/etc/chipcard/
The system-wide configuration files.
/var/log/chipcard/
The default log files.
SEE ALSO
http://www.libchipcard.de
Homepage of libchipcard project.
/usr/share/doc/libchipcard-tools/
Local documentation.
REVISION
Manual for kvkcard 2009 March 19th KVKCARD(1)