Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how do i do stdout redirection in a child process

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I am trying to write a daemon in C, but i cannot get my child process to write to a file, any attempts i have made, make the file but nothing goes in it, i have permissions.<br><br>Any method would be great, just so long as it works!!!&nbsp;&nbsp;stdout redirection would be nice tho.<br><br>Thanks
 
Hi,<br><br>Big topic this.<br><br>First off - could I reccomend a book to you? &quot;Unix Network Programming&quot; by W. Richard Stevens published by Prentice Hall ISBN 0 13 949876 1<br><br>Second - can you tell us where you have got to so far? (english - not code &lt;grin&gt; please) <p>Mike<br><a href=mailto:michael.j.lacey@ntlworld.com>michael.j.lacey@ntlworld.com</a><br><a href= Cargill's Corporate Web Site</a><br>
 
Try this -- if you closed all the open files inc stdout and stderr - like this:<br><FONT FACE=monospace><b><br>#include &lt;sys/param.h&gt;<br><br>for (i=0; i &lt; NOFILE; i++){<br>&nbsp;&nbsp;&nbsp;&nbsp;close(i);<br>}<br></font></b><br>Would the next 3 calls to open() open the file handles 0, 1 and 2? (stdin,stdout,stderr)<br> <p>Mike<br><a href=mailto:michael.j.lacey@ntlworld.com>michael.j.lacey@ntlworld.com</a><br><a href= Cargill's Corporate Web Site</a><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top