Difference between revisions of "C.php"
From Organic Design wiki
m |
(wrong dir!) |
||
Line 7: | Line 7: | ||
// Write the source to tmp file source.c | // Write the source to tmp file source.c | ||
− | if ($handle = fopen($htdocs.'/source.c', 'w+')) { | + | if ($handle = fopen($htdocs.'wiki/source.c', 'w+')) { |
fwrite($handle, $article); | fwrite($handle, $article); | ||
fclose($handle); | fclose($handle); |
Revision as of 06:35, 23 June 2006
<?
- C compiler for XmlWiki Environment
xwSetProperty($properties,'language','TEXT'); $server = $_SERVER['HTTP_HOST']; $htdocs = $_SERVER['DOCUMENT_ROOT']; if ( !ereg( "\\/$", $htdocs ) ) $htdocs .= '/';
// Write the source to tmp file source.c if ($handle = fopen($htdocs.'wiki/source.c', 'w+')) {
fwrite($handle, $article); fclose($handle); }
// Compile and output $gcc = $htdocs.'wiki/gcc'; $article = "Compiling using $gcc:\n"; $article .= shell_exec("$gcc 2>&1"); ?>