function to set input/output redirection