am using wamp server in windows.......i used exec and system funtion ...... i user syntax like <?php exec('g++ filename.cpp' , $result); echo $result; ?> but don't get any result..........wat is problem there ?....... space between g++ and filename is a problem??.......... and wat other solution willbe possible for excute cpp file ??..........
Are you use you have authorization to use exec. Chances are you are not, otherwise the output will be made. When you echo the output, what does it say? Peace,
Exec can work to say execute a shell script on your server. You could write that shell script to do whatever you need; compile some code.
For the code you're using, you'd need to modify it a bit to work. <?php exec('g++ filename.cpp -o programname.out' , $result); echo $result; exec('./programname.out' , $result); echo $result; ?> Code (markup): But that's assuming that you have got the permissions to run g++ on your hosting account, and from PHP... Honestly, I hope it doesn't work, because that host would have horrid security in place. You could also just write the web application in C++ if you wanted to be more direct.