title: How can i pass all files with full path in a directory to the argument array in execv?
body: <p>I'm trying to read all files (pictures) in a given directory and pass it to execv. I want to start the framebuffer image viewer (fbi).</p>
  
  <p>For now it works when i start it from the directory the pictures are in. How can i manipulate the vector so it not only holds the filenames but the path + filename?</p>
  
  <pre><code>int startSlideshow (char* pathtoFBI) {
  pid_t fbiPid;
  
  fbiPid = fork();
  
  if (fbiPid == 0) {
      /* this is the child process */
      DIR *pictureDirectory;
      struct dirent *dir;
      int i = 0;
      vector&lt;char*&gt; argVector;
      char pDirectory[] = "/home/pi/bilder/";
      argVector.push_back(pathtoFBI);         /* first Argument is Program name */
      pictureDirectory = opendir(pDirectory);
      if (pictureDirectory){
          while ((dir = readdir(pictureDirectory)) != NULL) {
              i++;
              if (i &gt; 2) {            /* first element is "." second is ".." */
                  argVector.push_back(dir-&gt;d_name);
              }
          }
          //i -= 2;
  
      } else ERREXIT("reading picture directory");
  
      closedir(pictureDirectory);
  
      argVector.push_back(NULL);
      char** fbiArgv = &amp;argVector[0];
      execvp(pathtoFBI, fbiArgv);         /* pid is taken over by fbi */
      _exit(EXIT_FAILURE);
  }
  </code></pre>