freopen
From cppreference.com
                    
                                        
                    
                    
                                                            
                    | Defined in header <stdio.h>
  | ||
| FILE *freopen( const char *filename, const char *mode, FILE *stream ); | ||
Reassigns an existing file stream stream to a different file identified by filenameusing specified mode. mode is used to determine the new file access mode.
[edit] Parameters
| filename | - | file name to associate the file stream to | ||||||||||||||||||||||||||||||||||||||||
| mode | - | null-terminated character string determining new file access mode 
 | ||||||||||||||||||||||||||||||||||||||||
| stream | - | the file stream to modify | ||||||||||||||||||||||||||||||||||||||||
[edit] Return value
stream on success, NULL on failure
[edit] See also
| opens a file (function) | |
| closes a file (function) | |