On Jan 24, 11:54 pm, "Kimmo Laine" <s...@outolempi.netwrote:
<snip>
Something like this:
in php:
echo system('myprogram 1');
myprogram.c:
// Apolgize my horrible C, it's been a million(?) years since i wrote C
main(argc, argv){
int i;
i = atoi(argv[1]);
j = callfunction(i);
printf('%d', j);
}This is just a very raw example, but you'll get the basic idea, right?
--
"Ohjelmoija on organismi joka muuttaa kofeiinia koodiksi" - lpkhttp://outolempi.net/ahdistus/- Satunnaisesti päivittyvä nettisarjis
s...@outolempi.net | rot13(x...@bhgbyrzcv.arg)
Just a couple small nitpicks. Sorry, I've actually just begun writing
C, so I'm very engaged, and enjoy every opportunity to write in it. :-)
int main(int argc, char** argv)
{
int i,j;
i = atoi(argv[1]);
j = callfunction(i);
printf("%d", j); /* you need double quotes here, single quotes
are for characters only */
return 0;
}
Oh yes, something useful! If you want to store the output of a command
line call, it's pretty easy to do this:
<?php
$cli = `my_program arg1 arg2 arg3 ...`;
?>
Notice that back ticks are used. Also, this example assumes that your
program is in the PATH. If your program's in the same directory, and
you're on *nix, then you have to precede your program with "./".
--
Curtis