title: Calling 'ls' with execv
body: <p>I am new to system calls and C programming and am working on my university assignment.</p>
  
  <p>I want to call the 'ls' command and have it print the directory.</p>
  
  <p>What I have: (I have added comments in so you can see what I see coming through each variable.</p>
  
  <pre><code>int execute( command* cmd ){
  
    char full_path[50];
    find_fullP(full_path, p_cmd); 
    //find_fullP successfully updates full_path to /bin/ls
    char* args[p_cmd-&gt;argc];
    args[0] = p_cmd-&gt;name;
    int i;
    for(i = 1; i &lt; p_cmd-&gt;argc; i++){
        args[i] = p_cmd-&gt;argv[i];
    }
  
  /*
   * this piece of code updates an args variable which holds arguments 
   * (stored in the struct) in case the command is something else that takes 
   * arguments. In this case, it will hold nothing since the command 
   * will be just 'ls'.
   */
  
    int child_process_status;
    pid_t child_pid;
    pid_t pid;
  
    child_pid = fork();
  
    if ( child_pid == 0 ) {
        execv( full_path, args );
        perror("fork child process error condition!" );
    }
  
    pid = wait( &amp;child_process_status );
    return 0;
  }
  </code></pre>
  
  <p>I am not seeing anything happening and am confused, any idea?</p>