Closes a currently open stream input/output file and reopens a new file under the specified file name.
FILE *freopen (const char *fname, const char *mode, FILE *fp);
fname Pointer to string indicating new file name
mode Pointer to string indicating file access mode
fp File pointer to currently open stream input/output file
The freopen function first closes the stream input/output file indicated by file pointer fp (the following processing is carried out even if this close processing is unsuccessful). Next, the freopen function opens the file indicated by file name fname for stream input/output, reusing the FILE structure pointed to by fp.
The freopen function is useful when there is a limit on the number of files being opened at one time.
The freopen function normally returns the same value as fp, but returns NULL when an error occurs.