Name
freopen function — Opens a file with an existing stream
Synopsis
FILE* freopen(const char* filename, const char* mode, FILE* stream)
The freopen
function opens
a file using an existing stream. The file previously associated with
the stream
is closed first, and
the named file is opened in the same manner as if fopen
were called. See fopen
for a description of the mode
parameter.
The main purpose of using freopen
is to reopen one of the standard
files: stdin
, stdout
, and stderr
.
See Also
Get C++ In a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.