> Message du 30/11/08 06:52
> De : "Richard"
> A : beginners@perl.org
> Copie à :
> Objet : capturing output from c program inside of perl
>
>
> i have a c program that I want to just run from perl and capture output
>
> I would have thought
>
> my $c_output = `/tmp/c_program`;
>


I was not sure what you're asking for, but the statement above really get what 
you wanted.
If you want to capture the STDERR too, could say:
my $output = `/tmp/c_program 2>&1`;

If you want to change the STDOUT temporarily, use a select.
my $old = select OTHER_FD;
some_statements;
select $old;

But, this is may not effective to a system call, since system may open an 
external shell.

--
Jeff Pang
http://home.arcor.de/pangj/

 Créez votre adresse électronique [EMAIL PROTECTED] 
 1 Go d'espace de stockage, anti-spam et anti-virus intégrés.

Reply via email to