评分程序 - 编译/执行c ++中的c ++代码 [英] Grading Program - Compile/executing c++ code within c++
问题描述
我正在写一个程序来评分学生提交的c ++代码。现在,它使用系统调用来编译每个源文件,然后将输入重定向到一个文件,并在进程中调用新的可执行文件,并在输出中搜索某些字符串。这也允许我对程序崩溃的进程超时。
有没有更好的方法来做这个比系统调用?
您可能希望在备用帐户下运行程序,如果任何分配需要用户交互,那么 expect
I am writing a program to grade c++ code that students submit. Right now it uses a system call to compile every source file then redirects the input to a file and calls the new executables in processes and searches the output for certain strings. This also allows me to have a timeout on processes for programs that crash.
Is there a better way to do this than a system call? Or a better way to do this in general?
You may want to run the programs under an alternate account, e.g. ssh with key-based authentication is a good way to switch to a dummy account.
If any of the assignments require user interaction, then expect
(which is Tcl-based) would be a good choice.
这篇关于评分程序 - 编译/执行c ++中的c ++代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!