如何在另一个程序下执行c程序

时间:2010-11-26 11:26:02

标签: c ansi

如何在另一个程序下执行c程序。假设你有一个c代码(程序) ,并且您想要调用另一个,因为您希望向其发送输入,然后通过比较另一个预期的返回数据对其返回数据进行评分。

示例:

 FILE try. c 

 int main  ( void ) 
   {
    for i = 0 ;  i < MAX ; ++i 
       call another program ( namely, try2.c ) to give it a single input 
       then measure its returning data
 return 0;
}

try2.c驻留在另一个文件

编译器是gcc,在系统linux下,

1 个答案:

答案 0 :(得分:3)

systempopen或平台依赖的功能,例如forkexec