UPDATE: managaed to get this working thanks to a similar thread, and some adjustments here and there.
So far in my program i:
-Fork a new process
inside the child, i exec a program entered by the user.
I want to send the ouput of this program, down a pipe ( pipe 1 ), rather than to stdout.
I then want to exec another program, sending it the information in pipe 1, and then outputting to stdout.
pid = fork();
if (pid == -1)
/* child */
if (pid == 0)
/* dont need the read end */
/* output will now be send down out pipe */
fprintf(stderr,"No such command: %s\n",clist->exe_path);
/* parent */
npid = wait(&stat);
//printf("Process %d exited with status %d\n",npid,stat);
while (npid != pid);
After the child exec's and exits, in the parent, i figure i create another child process, and exec in the newly created child.
How though, do i set it up so the new process reads from pipe 1, and outputs to stdout.
Hope I explained well enough for some to understand
Appreciate the help.