Need a help to implement the following. I have a C program file as follows:
#include <stdio.h>
main()
{
int x;
int args;
printf("Enter an integer: ");
if (( args = scanf("%d", &x)) == 0) {
printf("Error: not an integer\n");
} else {
printf("Read in %d\n", x);
}
if (( args = scanf("%d", &x)) == 0) {
printf("Error: not an integer\n");
} else {
printf("Read in %d\n", x);
}
}
I generated a.out and now I want to call this a.out using exec("a.out", $output). But my problem is that I'm getting how to pass the value of integer when it asks for. I tried using proc_open() but I could not understand its usage. I will appreciate your help if you can give me piece of PHP code which can handle this to pass these two values and finally print the received result.
Best Regards