954,517 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

how to programmatically compile C code using C# language

I am implementing multilanguage code editor in c#.after typing program in editor when user presses compiler button,c compiler should take program typed(c program) in text area as input & should return its object that will contains corresponding output(output or error if any) .
1) firstly how to call or link c compiler to our c# program?
2)then how to carried out above scenerio?
3) how to catch output given by c compiler?
please suggest solution to above stuff.
with regards,
chetan.

chetan21
Newbie Poster
1 post since Apr 2009
Reputation Points: 10
Solved Threads: 0
 

you can compile c from command line, just use the same from c#
the redirectstandardoutput will allow you to get the output that would be displayed as well

Process proc = new Process();
proc.StartInfo.FileName = "compiler name";
proc.StartInfo.RedirectStandardOutput = true;
proc.Start();

string output = proc.StandardOutput.ReadToEnd();
dickersonka
Veteran Poster
1,175 posts since Aug 2008
Reputation Points: 130
Solved Threads: 143
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You