I'm running execl function to compile a program through my code. And I want to check if the compilation went right. so I wrote b = execl("usr/bin/gcc","cc",path,NULL);
and later checked if( b==-1)
. But even though there were errors in the compilations it didnt get into the if statement.
Any ideas why?
Thank you!
int b=0;
if ((pid1 = fork())<0)
perror("Error forking");
else {
if(pid1==0)
b= execl("/usr/bin/gcc","cc",path,NULL);
else wait(&status);
}
if(b==-1)
printf("\n--------\n");