Use fdopen to accommodate OS specific I/O streams

- STDIN_FILENO  = 0
- STDOUT_FILENO = 1
- STDERR_FILENO = 2

Fixes #101