If a program runs
fork() what sets standard streams
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.
As Kyle Jones states, they're propagated from the parent process. If you're asking how to set them in a child, you're looking for