Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
freopen
◄Summary► ◄Example► ◄Up► ◄Contents► ◄Index► ◄Back►
────────────────────────────────────────────────────────────────────────────
The freopen function closes the file currently associated with
<stream> and reassigns <stream> to the file specified by
<filename>. The freopen function is typically used to redirect the
preopened files stdin, stdout, and stderr to files specified by
the user.
The new file associated with <stream> is opened with <mode>, which
is a character string specifying the type of access requested for
the file.
The valid types are "r" (read), "w" (write), and "a" (append).
Any of these can be followed by a "+", which allows both read
and write operations. The translation mode for newlines can be
specified by adding a "t" (text) or a "b" (binary).
See also the individual constants for access type and translation
mode.
See: ◄BINMODE.OBJ►
Return Value
The freopen function returns a pointer to the newly opened file.
If an error occurs, the original file is closed and the function
returns a NULL pointer value.
-♦-