in reply to Re^2: redirecting output to STDERR and STDOUT
in thread redirecting output to STDERR and STDOUT

On Solaris and Linux /dev/stdin, /dev/stdout, and /dev/stderr are device names for standard input, standard output, and standard error. /dev/stdin is occasionally useful when piping data to a recaltricant C program which doesn't read from standard input or recognise '-' as a synonym for standard input. Likewise for the others. In your case you would set $logfile = "/dev/stderr"; of course this will only help you if your OS supports /dev/stderr. /dev/fd/2 might be another option for standard error. On Solaris, man -s 4 fd for details.

Replies are listed 'Best First'.
Re^4: redirecting output to STDERR and STDOUT
by TilRMan (Friar) on Feb 23, 2005 at 06:08 UTC

    I can confirm that /dev/stdin and friends work on Linux.

    If you are on an otherwise unixy system that does not have these, you should be able to create a FIFO (a.k.a. named pipe) for each stream, spawn child processes to pipe them to STDOUT and STDERR, and hand the FIFO names to C. See "Named Pipes" in perlipc.

Re^4: redirecting output to STDERR and STDOUT
by Anonymous Monk on Feb 23, 2005 at 20:48 UTC
    Excellent! Using /dev/stdout and /dev/stderr did exactly what I needed it to do. Thank you!