title: Why doesn't execlp allow me to use a pipe?
body: <pre><code>#include &lt;stdio.h&gt;
  #include &lt;unistd.h&gt;
  main()
  {
      execlp("ls" , "ls", "-l", "|" , "sort", NULL);    
  }
  </code></pre>
  
  <p>What's going wrong? Please help.</p>
  
  <p>If I write this: <code>execlp("ls" , "ls", "-l", NULL);</code> then the result displays on screen and if I try this <code>execlp("ls" , "ls", "-l", "|" , "sort", NULL);</code> screen displays error message <em>cannot access</em>.</p>
  
  <p>Why? Does anyone have any idea? Why doesn't it allow me to use pipe (<code>|</code>) when I execute the command <code>execlp</code>?</p>