STDIN(3)                   POSIX Programmer's Manual                  STDIN(3)



PPRROOLLOOGG
       This manual page is part of the POSIX Programmer's Manual.  The OS
       implementation of this interface may differ (consult the corresponding
       OS manual page for details of OS behavior), or the interface may not be
       implemented on OS.


NNAAMMEE
       stderr, stdin, stdout -- standard I/O streams

SSYYNNOOPPSSIISS
       #include <stdio.h>

       extern FILE *stderr, *stdin, *stdout;

DDEESSCCRRIIPPTTIIOONN
       The functionality described on this reference page is aligned with the
       ISO C standard. Any conflict between the requirements described here
       and the ISO C standard is unintentional. This volume of POSIX.1-2008
       defers to the ISO C standard.

       A file with associated buffering is called a _s_t_r_e_a_m and is declared to
       be a pointer to a defined type FFIILLEE.  The _f_o_p_e_n() 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 _<_s_t_d_i_o_._h_> header and
       associated with the standard open files.

       At program start-up, three streams shall be predefined and need not be
       opened explicitly: _s_t_a_n_d_a_r_d _i_n_p_u_t (for reading conventional input),
       _s_t_a_n_d_a_r_d _o_u_t_p_u_t (for writing conventional output), and _s_t_a_n_d_a_r_d _e_r_r_o_r
       (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.

       The following symbolic values in _<_u_n_i_s_t_d_._h_> define the file descriptors
       that shall be associated with the C-language _s_t_d_i_n, _s_t_d_o_u_t, and _s_t_d_e_r_r
       when the application is started:

       STDIN_FILENO  Standard input value, _s_t_d_i_n.  Its value is 0.

       STDOUT_FILENO Standard output value, _s_t_d_o_u_t.  Its value is 1.

       STDERR_FILENO Standard error value, _s_t_d_e_r_r.  Its value is 2.

       The _s_t_d_e_r_r stream is expected to be open for reading and writing.

RREETTUURRNN VVAALLUUEE
       None.

EERRRROORRSS
       No errors are defined.

       _T_h_e _f_o_l_l_o_w_i_n_g _s_e_c_t_i_o_n_s _a_r_e _i_n_f_o_r_m_a_t_i_v_e_.

EEXXAAMMPPLLEESS
       None.

AAPPPPLLIICCAATTIIOONN UUSSAAGGEE
       None.

RRAATTIIOONNAALLEE
       None.

FFUUTTUURREE DDIIRREECCTTIIOONNSS
       None.

SSEEEE AALLSSOO
       _f_c_l_o_s_e(), _f_e_o_f(), _f_e_r_r_o_r(), _f_i_l_e_n_o(), _f_o_p_e_n(), _f_p_r_i_n_t_f(), _f_r_e_a_d(),
       _f_s_c_a_n_f(), _f_s_e_e_k(), _g_e_t_c(), _g_e_t_s(), _p_o_p_e_n(), _p_u_t_c(), _p_u_t_s(), _r_e_a_d(),
       _s_e_t_b_u_f(), _s_e_t_v_b_u_f(), _t_m_p_f_i_l_e(), _u_n_g_e_t_c(), _v_f_p_r_i_n_t_f()

       The Base Definitions volume of POSIX.1-2008, <<ssttddiioo..hh>>, <<uunniissttdd..hh>>

CCOOPPYYRRIIGGHHTT
       Portions of this text are reprinted and reproduced in electronic form
       from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
       -- Portable Operating System Interface (POSIX), The Open Group Base
       Specifications Issue 7, Copyright (C) 2013 by the Institute of
       Electrical and Electronics Engineers, Inc and The Open Group.  (This is
       POSIX.1-2008 with the 2013 Technical Corrigendum 1 applied.) 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.unix.org/online.html .

       Any typographical or formatting errors that appear in this page are
       most likely to have been introduced during the conversion of the source
       files to man page format. To report such errors, see
       https://www.kernel.org/doc/man-pages/reporting_bugs.html .



IEEE/The Open Group                  2013                             STDIN(3)
