Click here to Skip to main content
15,886,873 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

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.

Regards,
Raj
Posted
Comments
[no name] 7-Sep-14 7:52am    
System.Diagnostics.Process

What do you mean at "Run C/C++ program"?


If you want to start another process, you can use the Process class.


If you want to call a C++ function from your managed code, you can see my CP article about: Exposing native to managed - C++/CLI vs. P/Invoke.

 
Share this answer
 
Probably you could:
  • Save your text into a (source) file.
  • compile the source file using an actual C/C++ compiler.
  • Upon successfull compilation, run the executable redirecting its output to a text file, say out.txt
  • Show the out.txt content in your page.

It is worth noting each of the above steps has its caveats.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900