I have been trying to implement an ide on my website. Like if I want to run this program:
/* add c headers if necessary*/
#include <stdio.h>
/* Include other headers as needed */
int main()
{
/* Enter your code here. Read input from STDIN. Print output to STDOUT */
int a,b;
scanf("%d%d",&a,&b); // requires user input
return 0;
}
This program will get executed at my Linux server using some script.
As this program requires input from user,I have provided a textbox to user to provide that input. Then, I save that input in some file at my backend and supplying it through that file to my program and corresponding result is shown on my webpage.
But now I want user give input one by one.
For this I will need to catch when it requires input through my script then I will terminate my script and send response to user for that input.... Then will be feeding that input to program and again do the same if again some input require.
If something not clear please ask...
tmp. Call the programm withtail -f tmp | userprogram. Whenever the user enters something, append his/her input totmp.