Monday, February 7, 2011

compiler for my web site

Hi,

I am planning to build an algorithm web site that compiles the c and other language programs. I want to know is there any readymade tools/libraries for that?.

  • I may be mistaken, but assuming you have a unix server, you should have gcc or some form of c compiler already installed. Then, it's as simple as getting your server side scripting language access to the folder with gcc, writing the code to a file, and compiling.

    1. Write the code to a file.
    2. Do something like <?php shell_exec('gcc filename') ?> with whatever compiler options you want
    3. Execute the progam - <?php echo shell_exec('compiled_filename') ?>

    Of course, you'll want to check that the file compiled properly, and doing it as I described without any security measures is a huge security hole.

    From Sam Dufel

0 comments:

Post a Comment