Grading Program - Compile/executing C++ code within C++

前端 未结 2 1205
轮回少年
轮回少年 2020-12-20 07:14

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

2条回答
  •  伪装坚强ぢ
    2020-12-20 07:30

    I can't think of other way in C/C++ to run an external executable without using a system call (directly or indirectly).

    You may consider using Perl/Python instead of coding C++ to do such checking/automation.

    EDIT:

    Since you started scripting in Perl, you may want to look at:

    http://perldoc.perl.org/functions/exec.html

    http://perldoc.perl.org/Shell.html

    http://perldoc.perl.org/functions/system.html

    http://www.perlmonks.org/?node_id=78523

    How can I run a system command in Perl asynchronously?

    How can I terminate a system command with alarm in Perl?

提交回复
热议问题