I am having big c
program.I want execute that function in php and get value
For example
C program
int add( int, int);
void main()
{
int i=1;
printf("i starts out life as %d.", i);
i = add(5, 10);
printf(" And becomes %d after function is executed.\n", i);
}
int add( int a, int b)
{
int c;
c = a + b;
return c;
}
my web form has value a and b. so when i submit form i want to call the c function add and get the output.
I know there is a function to execute external programs in php like
exec()
shell_exec()
But i am not familiar with this functions.so please give me sample of code. Should i place the c program file(in notepad) in server root folder.
Please guide me ! Thanks in advance