Jump to content

Check out our Community Blogs

Register and join over 40,000 other developers!

Recent Status Updates

View All Updates

- - - - -

Compiling and Running C/C++ Programs from Webpage

c# asp.net

This topic has been archived. This means that you cannot reply to this topic.
1 reply to this topic

#1 hussainahmad28


    CC Lurker

  • Just Joined
  • Pip
  • 1 posts

Posted 17 May 2014 - 09:28 AM


I am new to ASP.NET and I have a challenge here:

I have to create a webpage which should take C/C++ program from textarea and should produce output of the program below the textarea using label when a button is clicked on the webpage.

I have no difficulty creating the front page(textarea,button,label or other controls) and reading the content of textarea in back end page(cs page).

But I don't have any idea how I can compile and run the program read from textarea and produce the output which can be assigned to a label on webpage.

Any help on this will be much appreciated.


#2 BlackRabbit


    CodeCall Legend

  • Expert Member
  • PipPipPipPipPipPipPipPip
  • 3871 posts

Posted 17 May 2014 - 07:46 PM

Welcome aboard Hussain,


The task insn't complex, but complicated.

Let's suppose the code in the textarea has no errors, compiles good, and have no need of input, and uses not extra libs. In that scenerio, the process only involves you executing the c++ compiler, then executing the create executable redirecting the output to a file, and then loading that output file to the next TextArea. For that specific case, you'll need to set permissions to the internet user to execute a c++ compiler, and then the exe in your server... I am not sure that's a good idea... ever heard of security? and we are talking c++....

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download