title: Redirection inside call to execvp() not working
body: <p>I've been implementing a small program that executes a given command using execvp(). It works fine when not using redirection, but when I run a command such as:</p>
  
  <pre><code>cat file1.txt &gt; redirected.txt
  </code></pre>
  
  <p>cat outputs the following error messages and fails:</p>
  
  <pre><code>cat: &gt;: No such file or directory
  cat: redirected.txt: No such file or directory
  </code></pre>
  
  <p>I've done some digging around and I'm starting to think that perhaps execvp() isn't allowed to do redirection because it doesn't run in the shell. Does that mean that I would have to manually pick out when redirection occurs and use pipes in my fork/exec code to get around this restriction? Is there a better way than to use execvp()?</p>
  
  <p>Thanks!</p>