title: Disable system() and exec() function in C and Pascal
body: <p>Is there any way to disable <code>system()</code> and <code>exec()</code> function in C/C++ and Pascal, by using any compiler argument or modifying header/unit file? (It's a Windows)</p>
  
  <p>I've tried using <code>-Dsystem=NONEXIST</code> for gcc and g++ but <code>#include &lt;cstdio&gt;</code> causes compile error.</p>
  
  <p>EDIT: Of course I know they can use <code>#undef system</code> to bypass the defense, so I've tried to comment out the <code>system</code> function line in stdlib.h, but that doesn't work too.</p>
  
  <p>EDIT2 (comment): It's a system, to which users submit their programs and the server compile and run it with different input data, then compare the program output with pre-calculated standard output to see if the program is correct. Now some users send code like <code>system("shutdown -s -t 0");</code> to shutdown the server. </p>
  
  <p>The server is running Windows system so I don't have any chroot environment. Also the server application is closed-source so I can do nothing to control how the program submitted by user is executed. What I can do is to modify the compiler commandline argument and modify header files.</p>