One of my favorite things about *nix is that stdin, stdout, and stderr are nothing more than user-space conventions supported by open(2) and dup(2) using the lowest numbered unused filehandle.