I am including a code snippet that will aid you.

# Location of your binary.
$yourbinary = "/usr/bin/yourprogram";

# Location of the libs for your c program if needed
$yourlib = YOUR_LIB . ":" . getenv("LD_LIBRARY_PATH");
putenv("LD_LIBRARY_PATH=$yourlib");

# The args to call the binary with
# For example:               
$arg1 = 10;
$arg2 = 15;

# Put together the command string
$command = "$yourbinary $arg1 $arg2";

$result = `$command`;
                
Be sure to check the return result from your program.

Hope this helps
Paul
-----Original Message-----
From: Sharad Tiwari [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, October 08, 2002 10:07 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Calling C functions


hi all,

I have just started working on PHP ... (just a couple of days back)
I had posted a question yesterday and could not get any rep from anyone
....

My problem is this ... I have to take inputs from a web-based interface
and pass them as parameters to a C function (or an executable program)
Could anyone of you kindly let me know how can I invoke such C library
functions or executables from php.

thanks for the help in advance.

Warm Regards,

Sharad


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to