.\" Copyright (c) 2001-2003 The Open Group, All Rights Reserved 
.TH "<stdio.h>" P 2003 "IEEE/The Open Group" "POSIX Programmer's Manual"
.\" <stdio.h> 
.SH NAME
stdio.h \- standard buffered input/output
.SH SYNOPSIS
.LP
\fB#include <stdio.h>\fP
.SH DESCRIPTION
.LP
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 IEEE\ Std\ 1003.1-2001, Section 2.2, The Compilation Environment)
to enable the visibility of these symbols in this
header. 
.LP
The \fI<stdio.h>\fP header shall define the following macros as positive
integer constant expressions:
.TP 7
BUFSIZ
Size of \fI<stdio.h>\fP buffers.
.TP 7
_IOFBF
Input/output fully buffered.
.TP 7
_IOLBF
Input/output line buffered.
.TP 7
_IONBF
Input/output unbuffered.
.TP 7
L_ctermid
Maximum size of character array to hold \fIctermid\fP() output. 
.TP 7
L_tmpnam
Maximum size of character array to hold \fItmpnam\fP() output.
.TP 7
SEEK_CUR
Seek relative to current position.
.TP 7
SEEK_END
Seek relative to end-of-file.
.TP 7
SEEK_SET
Seek relative to start-of-file.
.sp
.LP
The following macros shall be defined as positive integer constant
expressions which denote implementation limits:
.TP 7
{FILENAME_MAX}
Maximum size in bytes of the longest filename string that the implementation
guarantees can be opened.
.TP 7
{FOPEN_MAX}
Number of streams which the implementation guarantees can be open
simultaneously. The value is at least eight.
.TP 7
{TMP_MAX}
Minimum number of unique filenames generated by \fItmpnam\fP(). Maximum
number of times
an application can call \fItmpnam\fP() reliably. The value of {TMP_MAX}
is at least 25.
\ On XSI-conformant systems, the value of {TMP_MAX} is at least 10000.
.sp
.LP
The following macro name shall be defined as a negative integer constant
expression:
.TP 7
EOF
End-of-file return value.
.sp
.LP
The following macro name shall be defined as a null pointer constant:
.TP 7
NULL
Null pointer.
.sp
.LP
The following macro name shall be defined as a string constant:
.TP 7
P_tmpdir
Default directory prefix for \fItempnam\fP(). 
.sp
.LP
The following shall be defined as expressions of type "pointer to
\fBFILE\fP" that point to the \fBFILE\fP objects
associated, respectively, with the standard error, input, and output
streams:
.TP 7
\fIstderr\fP
Standard error output stream.
.TP 7
\fIstdin\fP
Standard input stream.
.TP 7
\fIstdout\fP
Standard output stream.
.sp
.LP
The following data types shall be defined through \fBtypedef\fP:
.TP 7
\fBFILE\fP
A structure containing information about a file.
.TP 7
\fBfpos_t\fP
A non-array type containing all information needed to specify uniquely
every position within a file.
.TP 7
\fBva_list\fP
As described in \fI<stdarg.h>\fP . 
.TP 7
\fBsize_t\fP
As described in \fI<stddef.h>\fP .
.sp
.LP
The following shall be declared as functions and may also be defined
as macros. Function prototypes shall be provided.
.sp
.RS
.nf

\fBvoid     clearerr(FILE *);

char    *ctermid(char *);

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    *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);

char    *gets(char *);

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 *);
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, int ...);

char    *tempnam(const char *, const char *);

FILE    *tmpfile(void);
char    *tmpnam(char *);
int      ungetc(int, FILE *);
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 arg);
\fP
.fi
.RE
.LP
Inclusion of the \fI<stdio.h>\fP header may also make visible all
symbols from \fI<stddef.h>\fP. 
.LP
\fIThe following sections are informative.\fP
.SH APPLICATION USAGE
.LP
None.
.SH RATIONALE
.LP
None.
.SH FUTURE DIRECTIONS
.LP
None.
.SH SEE ALSO
.LP
\fI<stdarg.h>\fP , \fI<stddef.h>\fP , \fI<sys/types.h>\fP , the System
Interfaces volume of IEEE\ Std\ 1003.1-2001, \fIclearerr\fP(), \fIctermid\fP(),
\fIfclose\fP(), \fIfdopen\fP(), \fIfgetc\fP(), \fIfgetpos\fP(), \fIferror\fP(),
\fIfeof\fP(), \fIfflush\fP(), \fIfgets\fP(), \fIfileno\fP(), \fIflockfile\fP(),
\fIfopen\fP(), \fIfputc\fP(), \fIfputs\fP(), \fIfread\fP(), \fIfreopen\fP(),
\fIfseek\fP(), \fIfsetpos\fP(), \fIftell\fP(), \fIfwrite\fP(), \fIgetc\fP(),
\fIgetc_unlocked\fP(), \fIgetwchar\fP(), \fIgetchar\fP(), \fIgetopt\fP(),
\fIgets\fP(), \fIpclose\fP(), \fIperror\fP(), \fIpopen\fP(), \fIprintf\fP(),
\fIputc\fP(), \fIputchar\fP(), \fIputs\fP(), \fIputwchar\fP(), \fIremove\fP(),
\fIrename\fP(), \fIrewind\fP(), \fIscanf\fP(), \fIsetbuf\fP(), \fIsetvbuf\fP(),
\fIsscanf\fP(), \fIstdin\fP, \fIsystem\fP(), \fItempnam\fP(), \fItmpfile\fP(),
\fItmpnam\fP(), \fIungetc\fP(), \fIvfscanf\fP(), \fIvscanf\fP(), \fIvprintf\fP(),
\fIvsscanf\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 .
