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:
<
It seems like the easiest thing to do is:
execlp( "/bin/sh", "/bin/sh", "-c", "cat file1.txt > redirected.txt", (char *)NULL );
You can do the same with execvp.
execvp