Jose Nyimi wrote:

-----Message d'origine-----
De : Ambikesh Chaurasia [mailto:[EMAIL PROTECTED] Envoyé : dimanche 10 avril 2005 18:30
À : perl
Objet : Capturing the integer return value of a "C" program, called inside perl script



Hi Guys,

I want to capture the return value of a "C" program
called inside a perl script. How to do this??

Let say I have a "C" program named "val_100.c" .

//val_100.c
#include <stdio.h>
int main()
{
 return 100;
}

I want to call this program from a perl script and
want to store the return value "100" in the perl
script. (Please note that I do not want to capture the
running status of the program).

Please guide me how to do this in a perl script.


perldoc -q backticks

my $ret_val = `c_prog_call`;

HTH,
José.


Backticks will capture data printed to STDOUT from the program run, not the return code.

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to