stdio.h(3)                 POSIX Programmer's Manual                stdio.h(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
       stdio.h -- standard buffered input/output

SSYYNNOOPPSSIISS
       #include <stdio.h>

DDEESSCCRRIIPPTTIIOONN
       Some of the functionality described on this reference page extends the
       ISO C standard. Applications shall define the appropriate feature test
       macro (see the System Interfaces volume of POSIX.1-2017, _S_e_c_t_i_o_n _2_._2,
       _T_h_e _C_o_m_p_i_l_a_t_i_o_n _E_n_v_i_r_o_n_m_e_n_t) to enable the visibility of these symbols
       in this header.

       The _<_s_t_d_i_o_._h_> header shall define the following data types through
       ttyyppeeddeeff:

       FFIILLEE          A structure containing information about a file.

       ffppooss__tt        A non-array type containing all information needed to
                     specify uniquely every position within a file.

       ooffff__tt         As described in _<_s_y_s_/_t_y_p_e_s_._h_>.

       ssiizzee__tt        As described in _<_s_t_d_d_e_f_._h_>.

       ssssiizzee__tt       As described in _<_s_y_s_/_t_y_p_e_s_._h_>.

       vvaa__lliisstt       As described in _<_s_t_d_a_r_g_._h_>.

       The _<_s_t_d_i_o_._h_> header shall define the following macros which shall
       expand to integer constant expressions:

       BUFSIZ        Size of _<_s_t_d_i_o_._h_> buffers.  This shall expand to a
                     positive value.

       L_ctermid     Maximum size of character array to hold _c_t_e_r_m_i_d() output.

       L_tmpnam      Maximum size of character array to hold _t_m_p_n_a_m() output.

       The _<_s_t_d_i_o_._h_> header shall define the following macros which shall
       expand to integer constant expressions with distinct values:

       _IOFBF        Input/output fully buffered.

       _IOLBF        Input/output line buffered.

       _IONBF        Input/output unbuffered.

       The _<_s_t_d_i_o_._h_> header shall define the following macros which shall
       expand to integer constant expressions with distinct values:

       SEEK_CUR      Seek relative to current position.

       SEEK_END      Seek relative to end-of-file.

       SEEK_SET      Seek relative to start-of-file.

       The _<_s_t_d_i_o_._h_> header shall define the following macros which shall
       expand to integer constant expressions denoting implementation limits:

       {FILENAME_MAX}
                     Maximum size in bytes of the longest pathname that the
                     implementation guarantees can be opened.

       {FOPEN_MAX}   Number of streams which the implementation guarantees can
                     be open simultaneously. The value is at least eight.

       {TMP_MAX}     Minimum number of unique filenames generated by _t_m_p_n_a_m().
                     Maximum number of times an application can call _t_m_p_n_a_m()
                     reliably. The value of {TMP_MAX} is at least 25.

                     On XSI-conformant systems, the value of {TMP_MAX} is at
                     least 10000.

       The _<_s_t_d_i_o_._h_> header shall define the following macro which shall
       expand to an integer constant expression with type iinntt and a negative
       value:

       EOF           End-of-file return value.

       The _<_s_t_d_i_o_._h_> header shall define NULL as described in _<_s_t_d_d_e_f_._h_>.

       The _<_s_t_d_i_o_._h_> header shall define the following macro which shall
       expand to a string constant:

       P_tmpdir      Default directory prefix for _t_e_m_p_n_a_m().

       The _<_s_t_d_i_o_._h_> header shall define the following macros which shall
       expand to expressions of type ``pointer to FFIILLEE'' that point to the
       FFIILLEE objects associated, respectively, with the standard error, input,
       and output streams:

       _s_t_d_e_r_r        Standard error output stream.

       _s_t_d_i_n         Standard input stream.

       _s_t_d_o_u_t        Standard output stream.

       The following shall be declared as functions and may also be defined as
       macros. Function prototypes shall be provided.


           void     clearerr(FILE *);
           char    *ctermid(char *);
           int      dprintf(int, const char *restrict, ...)
           int      fclose(FILE *);
           FILE    *fdopen(int, const char *);
           int      feof(FILE *);
           int      ferror(FILE *);
           int      fflush(FILE *);
           int      fgetc(FILE *);
           int      fgetpos(FILE *restrict, fpos_t *restrict);
           char    *fgets(char *restrict, int, FILE *restrict);
           int      fileno(FILE *);
           void     flockfile(FILE *);
           FILE    *fmemopen(void *restrict, size_t, const char *restrict);
           FILE    *fopen(const char *restrict, const char *restrict);
           int      fprintf(FILE *restrict, const char *restrict, ...);
           int      fputc(int, FILE *);
           int      fputs(const char *restrict, FILE *restrict);
           size_t   fread(void *restrict, size_t, size_t, FILE *restrict);
           FILE    *freopen(const char *restrict, const char *restrict,
                        FILE *restrict);
           int      fscanf(FILE *restrict, const char *restrict, ...);
           int      fseek(FILE *, long, int);
           int      fseeko(FILE *, off_t, int);
           int      fsetpos(FILE *, const fpos_t *);
           long     ftell(FILE *);
           off_t    ftello(FILE *);
           int      ftrylockfile(FILE *);
           void     funlockfile(FILE *);
           size_t   fwrite(const void *restrict, size_t, size_t, FILE *restrict);
           int      getc(FILE *);
           int      getchar(void);
           int      getc_unlocked(FILE *);
           int      getchar_unlocked(void);
           ssize_t  getdelim(char **restrict, size_t *restrict, int,
                        FILE *restrict);
           ssize_t  getline(char **restrict, size_t *restrict, FILE *restrict);
           char    *gets(char *);
           FILE    *open_memstream(char **, size_t *);
           int      pclose(FILE *);
           void     perror(const char *);
           FILE    *popen(const char *, const char *);
           int      printf(const char *restrict, ...);
           int      putc(int, FILE *);
           int      putchar(int);
           int      putc_unlocked(int, FILE *);
           int      putchar_unlocked(int);
           int      puts(const char *);
           int      remove(const char *);
           int      rename(const char *, const char *);
           int      renameat(int, const char *, int, const char *);
           void     rewind(FILE *);
           int      scanf(const char *restrict, ...);
           void     setbuf(FILE *restrict, char *restrict);
           int      setvbuf(FILE *restrict, char *restrict, int, size_t);
           int      snprintf(char *restrict, size_t, const char *restrict, ...);
           int      sprintf(char *restrict, const char *restrict, ...);
           int      sscanf(const char *restrict, const char *restrict, ...);
           char    *tempnam(const char *, const char *);
           FILE    *tmpfile(void);
           char    *tmpnam(char *);
           int      ungetc(int, FILE *);
           int      vdprintf(int, const char *restrict, va_list);
           int      vfprintf(FILE *restrict, const char *restrict, va_list);
           int      vfscanf(FILE *restrict, const char *restrict, va_list);
           int      vprintf(const char *restrict, va_list);
           int      vscanf(const char *restrict, va_list);
           int      vsnprintf(char *restrict, size_t, const char *restrict,
                        va_list);
           int      vsprintf(char *restrict, const char *restrict, va_list);
           int      vsscanf(const char *restrict, const char *restrict, va_list);

       Inclusion of the _<_s_t_d_i_o_._h_> header may also make visible all symbols
       from _<_s_t_d_d_e_f_._h_>.

       _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_.

AAPPPPLLIICCAATTIIOONN UUSSAAGGEE
       Since standard I/O streams may use an underlying file descriptor to
       access the file associated with a stream, application developers need
       to be aware that {FOPEN_MAX} streams may not be available if file
       descriptors are being used to access files that are not associated with
       streams.

RRAATTIIOONNAALLEE
       There is a conflict between the ISO C standard and the POSIX definition
       of the {TMP_MAX} macro that is addressed by ISO/IEC 9899:1999 standard,
       Defect Report 336. The POSIX standard is in alignment with the public
       record of the response to the Defect Report.  This change has not yet
       been published as part of the ISO C standard.

FFUUTTUURREE DDIIRREECCTTIIOONNSS
       None.

SSEEEE AALLSSOO
       <<ssttddaarrgg..hh>>, <<ssttddddeeff..hh>>, <<ssyyss__ttyyppeess..hh>>

       The System Interfaces volume of POSIX.1-2017, _S_e_c_t_i_o_n _2_._2, _T_h_e
       _C_o_m_p_i_l_a_t_i_o_n _E_n_v_i_r_o_n_m_e_n_t, _c_l_e_a_r_e_r_r(), _c_t_e_r_m_i_d(), _f_c_l_o_s_e(), _f_d_o_p_e_n(),
       _f_e_o_f(), _f_e_r_r_o_r(), _f_f_l_u_s_h(), _f_g_e_t_c(), _f_g_e_t_p_o_s(), _f_g_e_t_s(), _f_i_l_e_n_o(),
       _f_l_o_c_k_f_i_l_e(), _f_m_e_m_o_p_e_n(), _f_o_p_e_n(), _f_p_r_i_n_t_f(), _f_p_u_t_c(), _f_p_u_t_s(), _f_r_e_a_d(),
       _f_r_e_o_p_e_n(), _f_s_c_a_n_f(), _f_s_e_e_k(), _f_s_e_t_p_o_s(), _f_t_e_l_l(), _f_w_r_i_t_e(), _g_e_t_c(),
       _g_e_t_c_h_a_r(), _g_e_t_c___u_n_l_o_c_k_e_d(), _g_e_t_d_e_l_i_m(), _g_e_t_o_p_t(), _g_e_t_s(),
       _o_p_e_n___m_e_m_s_t_r_e_a_m(), _p_c_l_o_s_e(), _p_e_r_r_o_r(), _p_o_p_e_n(), _p_u_t_c(), _p_u_t_c_h_a_r(),
       _p_u_t_s(), _r_e_m_o_v_e(), _r_e_n_a_m_e(), _r_e_w_i_n_d(), _s_e_t_b_u_f(), _s_e_t_v_b_u_f(), _s_t_d_i_n,
       _s_y_s_t_e_m(), _t_e_m_p_n_a_m(), _t_m_p_f_i_l_e(), _t_m_p_n_a_m(), _u_n_g_e_t_c(), _v_f_p_r_i_n_t_f(),
       _v_f_s_c_a_n_f()

CCOOPPYYRRIIGGHHTT
       Portions of this text are reprinted and reproduced in electronic form
       from IEEE Std 1003.1-2017, Standard for Information Technology --
       Portable Operating System Interface (POSIX), The Open Group Base
       Specifications Issue 7, 2018 Edition, Copyright (C) 2018 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 .

       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                  2017                           stdio.h(3)
