1

Redirecting standard I/O: freopen + stdin/stdout vs open + dup2

view story
linux-howto

http://stackoverflow.com – I want to redirect stdin/stdout to some file. The program is being written for Unix OS but I think using standart C/C++ library instead of OS functions is good. I know how I can do that using OS functions dup2() and open() but I read some ways to do that using reopen() on stdin or stdout. Will reopening standart variables do what I want? Will it replace files opened at 0 and 1 file descriptors? Which way is better? (HowTos)