aboutsummaryrefslogtreecommitdiffstats
path: root/man3/stdin.3
diff options
context:
space:
mode:
authorMichael Kerrisk <mtk.manpages@gmail.com>2005-06-16 16:10:05 +0000
committerMichael Kerrisk <mtk.manpages@gmail.com>2005-06-16 16:10:05 +0000
commit6a4c2e3618c5d3ed6f269a3de60f144fdfcb8cd6 (patch)
tree2f104f1703ce12fe442dbfba2f1c57b2dd197512 /man3/stdin.3
parentb99cf1e0e851a535e51a19c7ce7e1936030fcb3a (diff)
downloadman-pages-6a4c2e3618c5d3ed6f269a3de60f144fdfcb8cd6.tar.gz
freopen(3) can change file descriptor associations of stin/stdout/stderr
Diffstat (limited to 'man3/stdin.3')
-rw-r--r--man3/stdin.312
1 files changed, 10 insertions, 2 deletions
diff --git a/man3/stdin.3 b/man3/stdin.3
index 42d027175b..ef72cfdd05 100644
--- a/man3/stdin.3
+++ b/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.