Couldn't write values to file!
"); //clean up and exit if unable to write } fclose($fp); //close and save the file echo "Saved to $file successfully!
"; //notify the user that file has been saved echo"Compiling the program $file
";
$output1 = shell_exec("g++ $srcpath -o $executable 2>&1");
/* try compiling the program with GCC and collect errors and warnings */
if($output1!=NULL)
{
echo "Error list:
$output1"; //display the errors and warnings if present } echo ""; if(file_exists($executable)) //check if executable exists { echo "
Running the program:
";
$output2 = shell_exec("echo $stdin | $executable $args 2>&1");
/* execute the file providing the necessary inputs and collect the output */
echo "
$output2"; echo "
Enter your code in the left frame and hit run to display the output.
"; /* tell the user to fill up the form on the left frame */ } ?>