faqts : Computers : Programming : Languages : PHP

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

3 of 7 people (43%) answered Yes
Recently 3 of 7 people (43%) answered Yes

Entry

i am calling an external C file but the output doesn't appear. Sometimes it does but it is incorrect

Feb 26th, 2008 00:06
dman, Antonatos Spiros, http://www.ttnr.org


First of all you can't call external c files in a php program, you would
have to first compile that external c file into a program, after that
either use backticks operator or one of the following functions :
  exec()
  passthru()
  popen()
  pcntl_exec()
Also, don't forget to provide complete path of the program and if you
are taking any input from the user , using  escapeshellcmd() function.
All of these functions or backticks operator simply pass back the the
output of the program in string format, so first make sure that your
program is behaving correctly by first executing it by hand and checking
the output. Another reason for wrong output could be passing of wrong
parameters, check that to make sure you are passing correct parameters
to the external program