freopen ¶POSIX specification:
https://pubs.opengroup.org/onlinepubs/9799919799/functions/freopen.html
Portability problems fixed by Gnulib:
stream does not already have an open
file descriptor, freopen returns the stream without opening
the file: glibc 2.24.
off_t is a 32-bit type, freopen may not work
correctly with files 2 GiB and larger. See Large File Support.
Portability problems not fixed by Gnulib:
errno
upon failure.
NULL file name argument on some
platforms:
OpenBSD 4.9, AIX 7.1, HP-UX 11.23, Solaris 10, mingw, MSVC 14.
fileno(f) will be the same
before and after a call to freopen(name,mode,f).
However, the
module freopen-safer can at least protect stdin, stdout,
and stderr.