/* Simple UNIX Programming Question:
I feel pretty lame... I must be missing something. I need to
programatically set my standard out to a file. I thought the
following sequence should do it but it doesn't work. Can some-
body help? Thanks,
Mark
PS - What I really want do do:
- fork/exec the csh with a script as an argument
- have the stdout of the shell go to a file instead of the
parents stdout
*/
#include <stdio.h>
#include <fcntl.h>
main ()
{
int fd;
fd = open ("./junk.out", O_CREAT);
dup2 (fd, 1);
close (fd);
printf ("fd=%d\n", fd);
Quote:}