
execl() problem in C under unix
Quote:
>Hi, I hope this is the right newsgroup for question, ...
Nope.
Quote:
>Here's my problem: I want to use the unistd.h execl() with pipes, like:
>execl("/usr/bin/cat","cat","fbrev.txt","|","/usr/lib/sendmail","-t",recepient,NULL);
>And it returns endless junk-text...
>Seems the problem is with the pipe |, does anyone know how to use pipes in
>execl() ? Is there a way around ?
If you want to set up a pipeline, you need to do a lot more work.
Look in the manual for exec(2), pipe(2), dup(2), close(2), exit(2).
For a good guide to general UNIX programming, I recommend Kernighan
& Pike's "The UNIX Programming Environment".
If you want to communicate on one end of a pipe with a process you
initiate, check out popen(3).
If all you really want to do is spawn a pipeline with which your
process will not interact, use the system(3) function instead.