mirror of https://github.com/mkerrisk/man-pages
88 lines
2.9 KiB
Plaintext
88 lines
2.9 KiB
Plaintext
.\" Copyright (c) 2001-2003 The Open Group, All Rights Reserved
|
|
.TH "STDIN" P 2003 "IEEE/The Open Group" "POSIX Programmer's Manual"
|
|
.\" stdin
|
|
.SH NAME
|
|
stderr, stdin, stdout \- standard I/O streams
|
|
.SH SYNOPSIS
|
|
.LP
|
|
\fB#include <stdio.h>
|
|
.br
|
|
.sp
|
|
extern FILE *stderr, *stdin, *stdout;
|
|
.br
|
|
\fP
|
|
.SH DESCRIPTION
|
|
.LP
|
|
A file with associated buffering is called a \fIstream\fP and is declared
|
|
to be a pointer to a defined type \fBFILE\fP. The \fIfopen\fP() function
|
|
shall create certain descriptive data for a stream and return a pointer
|
|
to designate the stream in all further transactions. Normally, there
|
|
are three open streams with constant pointers declared in the
|
|
\fI<stdio.h>\fP header and associated with the standard open files.
|
|
.LP
|
|
At program start-up, three streams shall be predefined and need not
|
|
be opened explicitly: \fIstandard input\fP (for reading
|
|
conventional input), \fIstandard output\fP (for writing conventional
|
|
output), and \fIstandard error\fP (for writing diagnostic
|
|
output). When opened, the standard error stream is not fully buffered;
|
|
the standard input and standard output streams are fully
|
|
buffered if and only if the stream can be determined not to refer
|
|
to an interactive device.
|
|
.LP
|
|
The
|
|
following symbolic values in \fI<unistd.h>\fP define the file descriptors
|
|
that shall
|
|
be associated with the C-language \fIstdin\fP, \fIstdout\fP, and \fIstderr\fP
|
|
when the application is started:
|
|
.TP 7
|
|
STDIN_FILENO
|
|
Standard input value, \fIstdin\fP. Its value is 0.
|
|
.TP 7
|
|
STDOUT_FILENO
|
|
Standard output value, \fIstdout\fP. Its value is 1.
|
|
.TP 7
|
|
STDERR_FILENO
|
|
Standard error value, \fIstderr\fP. Its value is 2.
|
|
.sp
|
|
.LP
|
|
The \fIstderr\fP stream is expected to be open for reading and writing.
|
|
.SH RETURN VALUE
|
|
.LP
|
|
None.
|
|
.SH ERRORS
|
|
.LP
|
|
No errors are defined.
|
|
.LP
|
|
\fIThe following sections are informative.\fP
|
|
.SH EXAMPLES
|
|
.LP
|
|
None.
|
|
.SH APPLICATION USAGE
|
|
.LP
|
|
None.
|
|
.SH RATIONALE
|
|
.LP
|
|
None.
|
|
.SH FUTURE DIRECTIONS
|
|
.LP
|
|
None.
|
|
.SH SEE ALSO
|
|
.LP
|
|
\fIfclose\fP() , \fIfeof\fP() , \fIferror\fP() ,
|
|
\fIfileno\fP() , \fIfopen\fP() , \fIfread\fP() , \fIfseek\fP() , \fIgetc\fP()
|
|
, \fIgets\fP() , \fIpopen\fP() , \fIprintf\fP() , \fIputc\fP() , \fIputs\fP()
|
|
, \fIread\fP() , \fIscanf\fP() , \fIsetbuf\fP() , \fIsetvbuf\fP()
|
|
, \fItmpfile\fP() , \fIungetc\fP() , \fIvprintf\fP() , the Base Definitions
|
|
volume of
|
|
IEEE\ Std\ 1003.1-2001, \fI<stdio.h>\fP, \fI<unistd.h>\fP
|
|
.SH COPYRIGHT
|
|
Portions of this text are reprinted and reproduced in electronic form
|
|
from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
|
|
-- Portable Operating System Interface (POSIX), The Open Group Base
|
|
Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
|
|
Electrical and Electronics Engineers, Inc and The Open Group. In the
|
|
event of any discrepancy between this version and the original IEEE and
|
|
The Open Group Standard, the original IEEE and The Open Group Standard
|
|
is the referee document. The original Standard can be obtained online at
|
|
http://www.opengroup.org/unix/online.html .
|