? exec/stdout

? exec/stdout

Post by Mark Fitzpatrick - Systems Engine » Wed, 17 Mar 1993 10:55:33



/* 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:}

 
 
 

1. What's the difference between in Exec and Exec exec ...

Well, I mean, in fvwm the normal way to add an item in fvwm's Menu
is write Exec exec program_name.
However, Exec program_name will also work.
But, what's the difference between these two ways?
Now, I want to add an item to execute a
command `LC_ALL=en_US.ISO8859-1 xterm'. The first can't work at all.
So I have to write `Exec LC_ALL=en_US.ISO8859-1 xterm'.
Can this make some damages to my system?

Thanks.

--
  Hongzheng Wang
  Department of Electronics Engineering
  Tsinghua University

2. 8-16 users, internet connect, and routing on one linux box?

3. Redirect stdout * stderr to one file in bourne sh using exec

4. Xlock crash and burn

5. how to capture output from child's stdout after fork/exec?

6. How to get Real Player to work with ALSA ?

7. How to Turn Off Stdout Buffering for An Exec'ed Process

8. ThinkPad 560 DualScan

9. redirecting STDOUT of a bg process to STDOUT of a new xterm

10. Writing ksh stdout to both file and stdout?

11. file descriptor Q, redirecting stderr and stdout to stdout and file.

12. Problem with exec of xterm -exec Telnet

13. exec $program || exec $alternative