Use C code to redirect standard I/O streams for --detach and --daemonize