Answer the question
In order to leave comments, you need to log in
Building an online compiler?
I want to write my own online compiler for c++. I understand how it works. A person enters his code on the site into the form, after which this code is sent to the server, where the result is compiled and back. How to send a file to the server is clear, but how to make it open there, run and give the result? Where to start, where can I read about it and how can I do it?
Answer the question
In order to leave comments, you need to log in
If you know how to compile from the terminal - exec() . Another question is how you will protect yourself from the execution of malicious code on the server, and you will definitely not be able to do this.
Use a third party compiler and guess
how to make it open there, run and give the result
You need to write a PHP script that will run compilation on the server using the shell_exec() command .
But of course it would be unsafe to execute arbitrary code on the server. Therefore, compilation and execution should be done in a virtual machine.
For example, here it is: https://github.com/mattgodbolt/compiler-explorer
And the project itself is online: https://godbolt.org/
By the way, most of the professional C++ developers use this tool.
Apple TV is not exactly omnivorous and omnipotent, but I find it the most interesting.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question