@node freopen, stdio @subheading Syntax @example #include FILE *freopen(const char *filename, const char *mode, FILE *file); @end example @subheading Description This function closes @var{file} if it was open, then opens a new file like @code{fopen(filename, mode)} but it reuses @var{file}. This is useful to, for example, associate @code{stdout} with a new file. @subheading Return Value The new file, or @code{NULL} on error. @subheading Portability @portability ansi, posix @subheading Example @example freopen("/tmp/stdout.dat", "wb", stdout); @end example