views:

229

answers:

7

hello,

I am developing a website for which I need an online c/C++ compiler for testing codes online.

Is there any possible and feasible solution for this.

i need this compiler so that students can test there code online.

Thnx in avance

+3  A: 

There's one: Online Compiler

Darin Dimitrov
+6  A: 

Codepad

For others languages too!

Liran Orevi
Thank you. There are no words... Just thank you!
Rekreativc
+3  A: 

You have to use a normal compiler and redirect the stdout and stderr to your website. Afaik there is no existing solution for this but you could ask the guys from Codepad how they made it.

From php this wouldn't be hard. Just get the output, run <a href="http://php.net/manual/en/function.fwrite.php">fwrite()</a> to write the file, then use <a href="http://us.php.net/manual/en/function.exec.php">exec()</a> to run gcc on it, then another exec() on the compiled program. It's not particularly secure at all though..
Brendan Long
+5  A: 

You can also try this: Comeau online compiler

Naveen
+4  A: 
  • Codepad - C, C++, D, Haskell, Lua, OCaml, PHP, Perl, Python, Ruby, Scheme, Tcl
  • The Zamplizer Bash, C#, C++, Groovy, Haskell, Java, Perl, Python, Ruby
  • CodeIDE Pascal, BASIC, C++, Asm, Perl, Javascript, HTML, Flex, MySQL, Prolog,Lisp
  • Comeau - C/C++
Nadir SOUALEM
+1  A: 

I only know the Comeau online compiler.

For sure this is the compiler people refer to when then want to know whether a code snippet respects the ISO C++ Standard (including upcoming new C++0x features)

Gregory Pakosz
A: 

You can try ideone.com

kuszi