redirect stdin when using execl
torsten
torsten at pcsbst.UUCP
Fri Jun 9 17:42:03 AEST 1989
In article <414 at sc50.UUCP> ron at sc50.UUCP ( Ron Winnacott ) writes:
>Hello net.
>
>Can anyone tell me how to redirect stdin when I use execl to
>start a new program. The problem I am haveing is this, I am writing
>a C program that forks then execl's a new program, But I need to
>use a redirect "<" in the execl call.
>
>execl("/bin/mail","mail","ron","<","/tmp/tfile",NULL);
I think this should do it:
execl("/bin/sh","sh","/bin/mail ron < /tmp/tfile",NULL);
Or you have to redirekt your stdin after fork and befor
execl to /tmp/tfile.
Hope that helps,
Torsten.
---
Name : Torsten Homeyer
Company : PCS GmbH, Pfaelzer-Wald-Str. 36, 8000 Munich W-Germany.
UUCP : ..[pyramid ;uunet!unido]!pcsbst!tho (PYRAMID PREFERRED!!)
DOMAIN : tho at pcsbst.pcs.[ COM From rest of world; DE From Europe ]
More information about the Comp.unix.wizards
mailing list