mirror of https://github.com/mkerrisk/man-pages
freopen(3) can change file descriptor associations of stin/stdout/stderr
This commit is contained in:
parent
b99cf1e0e8
commit
6a4c2e3618
12
man3/stdin.3
12
man3/stdin.3
|
@ -2,6 +2,7 @@
|
|||
.\"
|
||||
.\" This man page was written in 1998 by David A. Holland
|
||||
.\" and placed in the Public Domain. Polished a bit by aeb.
|
||||
.\" 2005-06-16 mtk, mentioned freopen()
|
||||
.\"
|
||||
.Dd March 24, 1998
|
||||
.Dt STDIN 3
|
||||
|
@ -48,14 +49,21 @@ interface, that is, the functions like
|
|||
.Xr read 2
|
||||
and
|
||||
.Xr lseek 2 .
|
||||
The integer file descriptors associated with the streams
|
||||
.Pp
|
||||
On program startup, the integer file descriptors
|
||||
associated with the streams
|
||||
.Nm stdin ,
|
||||
.Nm stdout ,
|
||||
and
|
||||
.Nm stderr
|
||||
are 0, 1, and 2, respectively. The preprocessor symbols STDIN_FILENO,
|
||||
are 0, 1, and 2, respectively.
|
||||
The preprocessor symbols STDIN_FILENO,
|
||||
STDOUT_FILENO, and STDERR_FILENO are defined with these values in
|
||||
<unistd.h>.
|
||||
(Applying
|
||||
.Xr freopen 3
|
||||
to one of these streams can change the file descriptor number
|
||||
associated with the stream.)
|
||||
.Pp
|
||||
Note that mixing use of FILEs and raw file descriptors can produce
|
||||
unexpected results and should generally be avoided.
|
||||
|
|
Loading…
Reference in New Issue