<!DOCTYPE html PUBLIC "‐//W3C//DTD XHTML 1.1//EN"
        "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">     <html
xmlns="http://www.w3.org/1999/xhtml"> <head>
    <link            rel="stylesheet"             type="text/css"
href="../../../style.css" title="style" />
    <link  rel="stylesheet"  type="text/css"  href="../style.css"
title="style" />
    <meta             http‐equiv="content‐type"              con‐
tent="text/html;charset=utf‐8" />

    <title>stdio.h.0p ‐ Linux manual page</title> </head>

<body>

<div        class="page‐top"><a       id="top_of_page"></a></div>
<!‐‐%%%TOP_BAR%%%‐‐> <!‐‐%%%PAGE_START%%%‐‐>

<table class="sec‐table"> <tr>
    <td>
        <p class="section‐dir"> <a href="#PROLOG">PROLOG</a> | <a
href="#NAME">NAME</a>  |  <a  href="#SYNOPSIS">SYNOPSIS</a>  | <a
href="#DESCRIPTION">DESCRIPTION</a> |  <a  href="#APPLICATION_US‐
AGE">APPLICATION&nbsp;USAGE</a>   |  <a  href="#RATIONALE">RATIO‐
NALE</a>   |   <a    href="#FUTURE_DIRECTIONS">FUTURE&nbsp;DIREC‐
TIONS</a>    |   <a   href="#SEE_ALSO">SEE&nbsp;ALSO</a>   |   <a
href="#COPYRIGHT">COPYRIGHT</a>
        </p>
    </td>
    <td class="search‐box">
        <div class="man‐search‐box">

            <form                method="get"                 ac‐
tion="http://www.google.com/search">
                <fieldset class="man‐search">
                    <input    type="text"    name="q"   size="10"
maxlength="255" value="" />
                    <input type="hidden"  name="sitesearch"  val‐
ue="man7.org/linux/man‐pages" />
                    <input  type="submit" name="sa" value="Search
online pages" />
                </fieldset>
            </form>

        </div>
    </td>
    <td> </td> </tr> </table>

<pre> <span class="headline">stdio.h(0P)               POSIX Pro‐
grammer’s  Manual               stdio.h(0P)</span>  </pre> <h2><a
id="PROLOG" href="#PROLOG"></a>PROLOG  &nbsp; &nbsp; &nbsp;  &nb‐
sp;        <a        href="#top_of_page"><span        class="top‐
link">top</span></a></h2><pre>
       This manual page is part of the POSIX Programmer’s Manual.
The Linux
       implementation of this interface may differ (consult the
       corresponding  Linux  manual page for details of Linux be‐
havior), or
       the interface may not be  implemented  on  Linux.   </pre>
<h2><a id="NAME" href="#NAME"></a>NAME  &nbsp; &nbsp; &nbsp; &nb‐
sp;        <a        href="#top_of_page"><span        class="top‐
link">top</span></a></h2><pre>
       stdio.h  —  standard  buffered  input/output </pre> <h2><a
id="SYNOPSIS" href="#SYNOPSIS"></a>SYNOPSIS  &nbsp; &nbsp; &nbsp;
&nbsp;       <a       href="#top_of_page"><span       class="top‐
link">top</span></a></h2><pre>
       #include &lt;stdio.h&gt;  </pre>  <h2><a  id="DESCRIPTION"
href="#DESCRIPTION"></a>DESCRIPTION   &nbsp; &nbsp; &nbsp; &nbsp;
<a             href="#top_of_page"><span              class="top‐
link">top</span></a></h2><pre>
       Some of the functionality described on this reference page
extends
       the ISO C standard. Applications shall define  the  appro‐
priate feature
       test   macro   (see   the   System  Interfaces  volume  of
POSIX.1‐2008, <i>Section</i>
       <i>2.2</i>, <i>The Compilation Environment</i>) to  enable
the visibility of these
       symbols in this header.

       The <i>&lt;stdio.h&gt;</i> header shall define the follow‐
ing data types through
       <b>typedef</b>:

       <b>FILE          </b>A  structure  containing  information
about a file.

       <b>fpos_t         </b>A  non‐array type containing all in‐
formation needed to
                     specify uniquely  every  position  within  a
file.

       <b>off_t                 </b>As        described        in
<i>&lt;sys/types.h&gt;</i>.

       <b>size_t          </b>As   described    in    <i>&lt;std‐
def.h&gt;</i>.

       <b>ssize_t               </b>As        described        in
<i>&lt;sys/types.h&gt;</i>.

       <b>va_list              </b>As        described         in
<i>&lt;stdarg.h&gt;</i>.

       The <i>&lt;stdio.h&gt;</i> header shall define the follow‐
ing macros which shall
       expand to integer constant expressions:

       BUFSIZ         Size  of  <i>&lt;stdio.h&gt;</i>   buffers.
This shall expand to a
                     positive value.

       L_ctermid      Maximum  size  of  character  array to hold
<i>ctermid</i>()
                     output.

       L_tmpnam      Maximum size  of  character  array  to  hold
<i>tmpnam</i>()
                     output.

       The <i>&lt;stdio.h&gt;</i> header shall define the follow‐
ing macros which shall
       expand to integer constant expressions with distinct  val‐
ues:

       _IOFBF        Input/output fully buffered.

       _IOLBF        Input/output line buffered.

       _IONBF        Input/output unbuffered.

       The <i>&lt;stdio.h&gt;</i> header shall define the follow‐
ing macros which shall
       expand to integer constant expressions with distinct  val‐
ues:

       SEEK_CUR      Seek relative to current position.

       SEEK_END      Seek relative to end‐of‐file.

       SEEK_SET      Seek relative to start‐of‐file.

       The <i>&lt;stdio.h&gt;</i> header shall define the follow‐
ing macros which shall
       expand to integer constant expressions denoting  implemen‐
tation
       limits:

       {FILENAME_MAX}
                     Maximum  size  in bytes of the longest path‐
name 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
                     <i>tmpnam</i>().  Maximum number of times an
application can
                     call <i>tmpnam</i>() reliably. The value  of
{TMP_MAX} is at
                     least 25.

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

       The <i>&lt;stdio.h&gt;</i> header shall define the follow‐
ing macro which shall
       expand  to an integer constant expression with type <b>int
</b>and a negative
       value:

       EOF           End‐of‐file return value.

       The <i>&lt;stdio.h&gt;</i> header shall define NULL as de‐
scribed in <i>&lt;stddef.h&gt;</i>.

       The <i>&lt;stdio.h&gt;</i> header shall define the follow‐
ing macro which shall
       expand to a string constant:

       P_tmpdir       Default  directory  prefix   for   <i>temp‐
nam</i>().

       The <i>&lt;stdio.h&gt;</i> header shall define the follow‐
ing macros which shall
       expand to expressions of type ‘‘pointer  to  <b>FILE</b>’’
that point to the
       <b>FILE  </b>objects  associated,  respectively,  with the
standard error,
       input, and output streams:

       <i>stderr</i>        Standard error output stream.

       <i>stdin</i>         Standard input stream.

       <i>stdout</i>        Standard output stream.

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

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

       Inclusion  of  the  <i>&lt;stdio.h&gt;</i> header may also
make visible all symbols
       from <i>&lt;stddef.h&gt;</i>.

       <i>The  following  sections  are  informative.</i>  </pre>
<h2><a  id="APPLICATION_USAGE"  href="#APPLICATION_USAGE"></a>AP‐
PLICATION    USAGE     &nbsp;    &nbsp;    &nbsp;    &nbsp;    <a
href="#top_of_page"><span                             class="top‐
link">top</span></a></h2><pre>
       Since standard I/O streams may use an underlying file  de‐
scriptor to
       access  the file associated with a stream, application de‐
velopers 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.  </pre> <h2><a id="RATIONALE"  href="#RATIO‐
NALE"></a>RATIONALE     &nbsp;    &nbsp;    &nbsp;    &nbsp;   <a
href="#top_of_page"><span                             class="top‐
link">top</span></a></h2><pre>
       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.  </pre> <h2><a id="FUTURE_DIRECTIONS" href="#FU‐
TURE_DIRECTIONS"></a>FUTURE DIRECTIONS  &nbsp; &nbsp; &nbsp; &nb‐
sp;        <a        href="#top_of_page"><span        class="top‐
link">top</span></a></h2><pre>
       None.    </pre>   <h2><a   id="SEE_ALSO"    href="#SEE_AL‐
SO"></a>SEE    ALSO     &nbsp;    &nbsp;    &nbsp;    &nbsp;   <a
href="#top_of_page"><span                             class="top‐
link">top</span></a></h2><pre>
       <a   href="../man0/stdarg.h.0p.html">stdarg.h(0p)</a>,  <a
href="../man0/stddef.h.0p.html">stddef.h(0p)</a>,              <a
href="../man0/sys_types.h.0p.html">sys_types.h(0p)</a>

       The  System  Interfaces volume of POSIX.1‐2008, <i>Section
2.2</i>, <i>The</i>
       <i>Compilation  Environment</i>,  <a  href="../man3/clear‐
err.3p.html">clearerr(3p)</a>,       <a       href="../man3/cter‐
mid.3p.html">ctermid(3p)</a>,                                  <a
href="../man3/fclose.3p.html">fclose(3p)</a>,
       <a     href="../man3/fdopen.3p.html">fdopen(3p)</a>,    <a
href="../man3/feof.3p.html">feof(3p)</a>,  <a  href="../man3/fer‐
ror.3p.html">ferror(3p)</a>,                                   <a
href="../man3/fflush.3p.html">fflush(3p)</a>,                  <a
href="../man3/fgetc.3p.html">fgetc(3p)</a>,                    <a
href="../man3/fgetpos.3p.html">fgetpos(3p)</a>,
       <a     href="../man3/fgets.3p.html">fgets(3p)</a>,      <a
href="../man3/fileno.3p.html">fileno(3p)</a>,                  <a
href="../man3/flockfile.3p.html">flockfile(3p)</a>,            <a
href="../man3/fmemopen.3p.html">fmemopen(3p)</a>,              <a
href="../man3/fopen.3p.html">fopen(3p)</a>,
       <a   href="../man3/fprintf.3p.html">fprintf(3p)</a>,    <a
href="../man3/fputc.3p.html">fputc(3p)</a>,                    <a
href="../man3/fputs.3p.html">fputs(3p)</a>,                    <a
href="../man3/fread.3p.html">fread(3p)</a>, <a href="../man3/fre‐
open.3p.html">freopen(3p)</a>,
       <a    href="../man3/fscanf.3p.html">fscanf(3p)</a>,     <a
href="../man3/fseek.3p.html">fseek(3p)</a>,                    <a
href="../man3/fsetpos.3p.html">fsetpos(3p)</a>,                <a
href="../man3/ftell.3p.html">ftell(3p)</a>,                    <a
href="../man3/fwrite.3p.html">fwrite(3p)</a>,                  <a
href="../man3/getc.3p.html">getc(3p)</a>,
       <a    href="../man3/getchar.3p.html">getchar(3p)</a>,   <a
href="../man3/getc_unlocked.3p.html">getc_unlocked(3p)</a>,    <a
href="../man3/getdelim.3p.html">getdelim(3p)</a>,              <a
href="../man3/getopt.3p.html">getopt(3p)</a>,                  <a
href="../man3/gets.3p.html">gets(3p)</a>,
       <a         href="../man3/open_memstream.3p.html">open_mem‐
stream(3p)</a>, <a  href="../man3/pclose.3p.html">pclose(3p)</a>,
<a        href="../man3/perror.3p.html">perror(3p)</a>,        <a
href="../man3/popen.3p.html">popen(3p)</a>,                    <a
href="../man3/putc.3p.html">putc(3p)</a>,
       <a    href="../man3/putchar.3p.html">putchar(3p)</a>,   <a
href="../man3/puts.3p.html">puts(3p)</a>,  <a   href="../man3/re‐
move.3p.html">remove(3p)</a>,         <a        href="../man3/re‐
name.3p.html">rename(3p)</a>,                                  <a
href="../man3/rewind.3p.html">rewind(3p)</a>,
       <a     href="../man3/setbuf.3p.html">setbuf(3p)</a>,    <a
href="../man3/setvbuf.3p.html">setvbuf(3p)</a>,                <a
href="../man3/stdin.3p.html">stdin(3p)</a>, <a href="../man3/sys‐
tem.3p.html">system(3p)</a>,        <a        href="../man3/temp‐
nam.3p.html">tempnam(3p)</a>,
       <a    href="../man3/tmpfile.3p.html">tmpfile(3p)</a>,   <a
href="../man3/tmpnam.3p.html">tmpnam(3p)</a>,                  <a
href="../man3/ungetc.3p.html">ungetc(3p)</a>,                  <a
href="../man3/vfprintf.3p.html">vfprintf(3p)</a>,              <a
href="../man3/vfscanf.3p.html">vfscanf(3p)</a>    </pre>   <h2><a
id="COPYRIGHT"  href="#COPYRIGHT"></a>COPYRIGHT   &nbsp;   &nbsp;
&nbsp;    &nbsp;    <a    href="#top_of_page"><span   class="top‐
link">top</span></a></h2><pre>
       Portions of this text  are  reprinted  and  reproduced  in
electronic form
       from  IEEE Std 1003.1, 2013 Edition, Standard for Informa‐
tion
       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 Cor‐
rigendum 1
       applied.) In the event of  any  discrepancy  between  this
version and
       the  original IEEE and The Open Group Standard, the origi‐
nal IEEE and
       The Open Group Standard is the referee document. The orig‐
inal
       Standard     can     be     obtained    online    at    <a
href="http://www.unix.org/online.html">http://www.unix.org/on‐
line.html</a> .

       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
       <a      href="https://www.kernel.org/doc/man‐pages/report‐
ing_bugs.html">https://www.kernel.org/doc/man‐pages/report‐
ing_bugs.html</a> .

<span class="footline">IEEE/The Open  Group                  2013
stdio.h(0P)</span> </pre>

<hr class="end‐man‐text" />

<hr class="start‐footer" />

<div class="footer">

<table class="colophon‐table">
    <tr>
    <td class="pub‐info">
        <p>
            HTML rendering created 2019‐08‐02
            by  <a  href="http://man7.org/mtk/index.html">Michael
Kerrisk</a>,
            author of
            <a  href="http://man7.org/tlpi/"><em>The  Linux  Pro‐
gramming Interface</em></a>,
            maintainer of the
            <a href="https://www.kernel.org/doc/man‐pages/">Linux
<em>man‐pages</em> project</a>.
        </p>
        <p>
            For details of in‐depth
            <strong>Linux/UNIX system programming training  cour‐
ses</strong>
            that  I  teach,  look <a href="http://man7.org/train‐
ing/">here</a>.
        </p>
        <p>
            Hosting   by    <a    href="http://www.jambit.com/in‐
dex_en.html">jambit GmbH</a>.
        </p>
        <p>
            <a href="http://validator.w3.org/check?uri=referer">
            <img src="http://www.w3.org/Icons/valid‐xhtml11"
                alt="Valid XHTML 1.1" height="31" width="88" />
            </a>
        </p>
    </td>
    <td class="colophon‐divider">
    </td>
    <td class="tlpi‐cover">
        <a                      href="http://man7.org/tlpi/"><img
src="http://man7.org/tlpi/cover/TLPI‐front‐cover‐vsmall.png"
alt="Cover of TLPI" /></a>
    </td>
    </tr> </table>

</div>

<hr class="end‐footer" />

</body> </html>