Dec 1, 2003, 3:40 AM
Post #3 of 3
You would call a C program in exactly the same way as you would call any other external program. There are a number of options depending on exactly what you want to do.
Re: [madhu_p] calling c programme in perl
[In reply to]
* If you want to capture the data that the program writes to STDOUT then you can use backticks (` ... ` or qx( ... )) or open a pipe to read from the program (open PROG, '/path/to/prog |')
* If you don't need to capture that data then you probably want "system".
* If you want to _replace_ your process with the external program then you can use "exec".
* If you want to spawn a separate process that runs at the same time then you can use "fork" and "exec".
Dave Cross, Perl Hacker, Trainer and Writer
Get more help at Perl Monks