Question 12.34

Once I've used freopen, how can I get the original stdout (or stdin) back?


There isn't a good way. If you need to switch back, the best solution is not to have used freopen in the first place. Try using your own explicit output (or input) stream variable, which you can reassign at will, while leaving the original stdout (or stdin) undisturbed.


Read sequentially: prev next up top


This page by Steve Summit // Copyright 1995 // mail feedback