Question

how can I execute c program under another one. assume you have one c code ( program ) , and you want to call another one because you want send input to it then score its return data with comparing another expected return data.

Example:

 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 reside in another FILE

Compiler is gcc, and under system linux,

Was it helpful?

Solution

system, popen or platform depended features like fork and exec

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top