Xref: utzoo comp.lang.c:19264 comp.unix.wizards:16821 Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!cs.utexas.edu!uunet!mcvax!unido!pcsbst!torsten From: torsten@pcsbst.UUCP (torsten) Newsgroups: comp.lang.c,comp.unix.wizards Subject: Re: redirect stdin when using execl Keywords: execl redirect stdin < Message-ID: <851@pcsbst.UUCP> Date: 9 Jun 89 07:42:03 GMT References: <414@sc50.UUCP> Reply-To: torsten@brahms.pcs.com (Torsten Homeyer) Organization: PCS GmbH, Pfaelzer-Wald-Str. 36, 8000 Muenchen; West-Germany Lines: 23 In article <414@sc50.UUCP> ron@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@pcsbst.pcs.[ COM From rest of world; DE From Europe ]