perlvariable and Cprogram

B

BCAL

Hi,

In my perl program i am calling a c_program. This c_program is waiting for
input which I generate in my perlscript.
How do I pass the perlvariable to my c_program and let the perlscript
continue.

thnx in advance, joe

--
 
N

nobull

BCAL said:
In my perl program i am calling a c_program. This c_program is waiting for
input which I generate in my perlscript.
How do I pass the perlvariable to my c_program and let the perlscript
continue.

Usually you'd use the pipe syntax of open().

open( my $subrocess, '|-', $program ) or die "Can't spawn $program:
$!";
print $subprocess "$perlvariable\n";

I'm assuming here that the program is not reliant on an EOF condition
on it's STDIN before it does its thing.

If it is then you need to use lower level pipe/fork/exec since close()
will wait for the subprocess.

Since this appears to be a question about interprocess commumication.
I humbly suggest you should have consulted the manual "Perl
interprocess communication" that comes with Perl.

This newsgroup does not exist (see FAQ). Please do not start threads
here.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,265
Messages
2,571,069
Members
48,771
Latest member
ElysaD

Latest Threads

Top