freopen

Reassign a file pointer.

FILE * freopen (char * filename, char * mode, FILE * stream);

Required Header
<stdio.h>

Return Value

This function returns a pointer to the newly open file. A null pointer value indicates an error, in which case the original file is closed.

Parameters

filename

  Filename

mode

  Type of access permitted

stream

  The pointer to the open FILE structure

Remarks

The freopen function closes the file associated with stream and opens the file specified by filename, usually to redirect one of the standard files stdin, stdout or stderr.

See fopen for more information on the open process and mode settings.

Stream I/O Routines

See Also    fclose, _fdopen, _fileno, fopen, _open, _setmode