mirror of https://github.com/mkerrisk/man-pages
fopen.3: Describe freopen() behavior for NULL pathname argument
See https://bugzilla.kernel.org/show_bug.cgi?id=191261 Reported-by: Helmut Eller <eller.helmut@gmail.com> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
parent
a8250b9163
commit
7eed8a8f10
22
man3/fopen.3
22
man3/fopen.3
|
@ -202,6 +202,28 @@ The
|
||||||
argument is used just as in the
|
argument is used just as in the
|
||||||
.BR fopen ()
|
.BR fopen ()
|
||||||
function.
|
function.
|
||||||
|
|
||||||
|
If the
|
||||||
|
.I path
|
||||||
|
argument is a null pointer,
|
||||||
|
.BR freopen ()
|
||||||
|
changes the mode of the stream to that specified in
|
||||||
|
.IR mode ;
|
||||||
|
that is,
|
||||||
|
.BR freopen ()
|
||||||
|
reopens the pathname that is associated with the stream.
|
||||||
|
The specification for this behavior was added in the C99 standard, which says:
|
||||||
|
|
||||||
|
.RS
|
||||||
|
In this case,
|
||||||
|
the file descriptor associated with the stream need not be closed
|
||||||
|
if the call to
|
||||||
|
.BR freopen ()
|
||||||
|
succeeds.
|
||||||
|
It is implementation-defined which changes of mode are permitted (if any),
|
||||||
|
and under what circumstances.
|
||||||
|
.RE
|
||||||
|
.PP
|
||||||
The primary use of the
|
The primary use of the
|
||||||
.BR freopen ()
|
.BR freopen ()
|
||||||
function is to change the file associated with a standard text stream
|
function is to change the file associated with a standard text stream
|
||||||
|
|
Loading…
Reference in New Issue