Hi,
If your C program is called c_program, just use the following.
my $output=qx/c_program/;
system() returns the exit status from a command, not it's output. See perldoc -f system.
cheers
thinker | [reply] [d/l] |
Unless you want to communicate via files (not adviced), usually pipes are used for this purpose. The less painful method, however, is to use the backticks (`) on a command, that transparently create an anonymous pipe and return the output to your script.
my $output = `path/program_name`;
qx// (Quoted eXecution) is an alternative to the backtics | [reply] [d/l] |
Considering you might not have access to modify that program's source code or might not know exactly what the code in the program will do, I suggest not only using the qx method, but also untainting any data you might also pass to the program.
CGI is always tricky. Users will find every vulnerability, eventually. Don't use backticks, unless everything in between them is in no way modifiable. Same with qx. Be wary of user-submitted input. Hope this helps.
John J Reiser
newrisedesigns.com
| [reply] |