[cs631apue] stderr close / reopen
Jan Schaumann
jschauma at stevens.edu
Mon Sep 13 22:06:43 EDT 2021
Hello,
Here's a quick code example of closing stderr and
reopening it:
https://stevens.netmeister.org/631/close-stderr.c
A different approach would be to first dup(2)
STDERR_FILENO, the close STDERR_FILENO, then again
dup(2)'ing STDERR_FILENO onto the fd from the first
dup(2) call.
Do give this approach a try to ensure you have a full
understanding of the mechanisms and file table
structures involved.
-Jan
More information about the cs631apue
mailing list