Or if the return values are more substantial....
#!/usr/bin/perl

# Get the first lot of results
@stdout_from_c_program = `'first-c-program`;
die "Didn't get anything" unless @stdout_from_c_program;

# Some processing ( or not )
@args = munge( @stdout_from_c_program );

# Hand the processed ( or not ) results to the second program ( assuming you
need to pass to the c program ).
system( "second-c-program $arg[0] $arg[1] $arg[2] etc" ); # Assuming you
need to get



Of course, I'm assuming the results will come back in one hit...
If you need to "stream" the results in over time, you would be more
interested in some of the cruftier uses of open().

Adam

----- Original Message -----
From: "Tony Green" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, March 01, 2002 6:14 PM
Subject: Re: [SLUG] ask perl & C


> * This one time, at band camp, henry said:
> > Dear List:
> >
> >              I need to
> >    use perl-script --> call c program --> return values to
perl-script -->call c program
> >                                         A
B                                 C
> >              At stage B , perl will get those return-values from
c-programs for next stage(C).
> > -------that's the problem         that I want to consult you,
> >
> >             Could someone shed some light on it?
> >  or
> >             by what keyword could I search internet?
> >
>
> #!/usr/bin/perl
>
> if (system('first-c-program') # Check if first-c-program returns non zero
> {
>     system('second-c-program') # if it does, run second-c-program
> }
> else
> {
>     system('third-c-program') # else run third-c-program
> }
>
>
>
> Is that what you're after Henry?
>
> Greeno
>
> (Note: this is untested and its been a long week, use at your own risk)
> --
> Greeno <[EMAIL PROTECTED]>
> GnuPG Key :  1024D/B5657C8B
> Key fingerprint = 9ED8 59CC C161 B857 462E  51E6 7DFB 465B B565 7C8B
>
> Imagine working in a secure environment and finding the string
> _NSAKEY in the OS binaries without a good explanation
>     -Alan Cox 04/05/2001
> --
> SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/
> More Info: http://lists.slug.org.au/listinfo/slug

-- 
SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/
More Info: http://lists.slug.org.au/listinfo/slug

Reply via email to