title: How do I pass pipes and other values through command line parameters in C?
body: <p>I'm trying to create a several programs, where the first one initiates all the required IPC elements. The problem I am having is executing the subsidiary programs with the values from the first. I have tried the following:</p>
  
  <pre><code>int sem_id = semget (key1, 4, IPC_CREAT | 0666);
  int shmid = shmget(key2, 1024, 0644 | IPC_CREAT);
  int pipe1[2];
  if (pipe (pipe1)){
      printf("Error: %s",strerror(errno));
      exit(1);
  }
  
  if(execl("/home/tropix/program-3","/home/tropix/program-3", sem_id, shmid, pipe1, (char*)0) == 0){
      fprintf(stderr, "File Execution of program 3 failed.\n");
      exit(1);
  }
  </code></pre>
  
  <p>Program 3 is not executing, so I obviously have a problem with my execl statement. If I remove the variables sem_id, shmid and pipe2 it runs.</p>
  
  <p>Thanks for any suggestions.</p>
  
  <p>Edit: added statements for creating shmid and sem_id. I can print these int's to stdout, so I'm sure they have a value. And as far as knowing whether program 3 is executing, see program 3:</p>
  
  <pre><code>main(int argc, char *argv[]){
      int x;
      printf("Number of args = %d", argc);
      for(x=0;x&lt;argc;x++){
      printf("arg#: %d, %s\n",x,argv[x]);
      }
  }
  </code></pre>
  
  <p>Another note: I have compiled program 3. If I remove the execl arguments and replace them with quoted words ("test"), they show up as arguments in the child page. But in this case, NOTHING is printing from program 3.</p>