I have a Perl program and a C program. I want to run the Perl program and capture the return value of C program. To make it clear:
C program (a.out)
int main()
{
printf("100");
return 100;
}
Perl program:
print `ls`; #OK
print `a.out`; #No error but it does not print any output.
Any ideas?
Thanks.
I don’t know perl but this works on my system so no guarantees:
For one reason or another
system()returns the return value bitshfted by 8 (so 0 will become 256, 1 will be 512… 7 will be 1792 or something like that) but I didn’t care to look up why.