In my program I am switching my cout to write to a file using the following:
int newstdout = open("myFile.txt",O_WRONLY|O_CREAT,S_IRWXU|S_IRWXG|S_IRWXO);
close(1);
dup(newstdout);
close(newstdout);
How would I later in the program switch back to my cout printing to the screen(terminal)?