title: How do you call a C program from within another C program
body: <p>I have two C programs, Project1A.c and Project1B.c. I'm trying to use execl() to execute Project1A from inside Project1B but so far it's not working.</p>
  
  <p>Project1B.c </p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;sys/types.h&gt;
  #include &lt;unistd.h&gt;
  
  int main ()
  {
    pid_t pid;
  
    switch((pid = fork()))
    {
      case -1:
        printf("I'm sorry, fork failed\n");
        break;
      case 0:
        execl("Project1A.c", "./prog", NULL);
        printf("EXECL Unsucessfull");
        break;
      default:
        printf("This is some parent code\n");
        break;
    }
    printf("End of Program\n");
  
    return 0;
  }
  </code></pre>