If a program runs fork()
what sets standard streams STDOUT
, STDIN
and STDERR
?
What sets a child’s STDERR, STDOUT, and STDIN
file-descriptorsfork
file-descriptorsfork
If a program runs fork()
what sets standard streams STDOUT
, STDIN
and STDERR
?
Best Answer
Stdin, stdout and stderr are inherited from the parent process. It's up to the child process to change them to point to new files if that is needed.
From the
fork(2)
man page: