V10/man/man3/stdio.3

Compare this file to the similar file:
Show the results in this format:

.TH STDIO 3S
.CT 2 file_io
.SH NAME
stdio \(mi standard buffered input/output package
.SH SYNOPSIS
.nf
.B #include <stdio.h>
.PP
.B FILE *stdin;
.B FILE *stdout;
.B FILE *stderr;
.fi
.SH DESCRIPTION
The functions described in Sections 3S constitute an efficient
user-level buffering scheme.
The in-line macros
.IR getc (3)
and
.IR  putc
handle characters quickly.
The higher level routines
.I "fgets, scanf, fscanf, fread,"
.I "puts, fputs, printf, fprintf, fwrite"
all use
.I getc
and
.I putc;
they can be freely intermixed.
.PP
A file with associated buffering is called a
.I stream,
and is declared to be a pointer to a defined type
.BR FILE .
.IR  Fopen (3)
creates certain descriptive data for a stream
and returns a pointer to designate the stream in all
further transactions.
There are three normally open streams with constant
pointers declared in
the include file and associated with the standard open files:
.TP 10n
.BR stdin
standard input file
.br
.ns
.TP
.B stdout
standard output file
.br
.ns
.TP
.BR stderr
standard error file
.PP
A constant pointer
.L
NULL
designates no stream at all.
.PP
An integer constant
.B EOF
is returned
upon end of file or error by integer functions that
deal with streams.
.PP
Any routine that uses the standard input/output package
must include the header file
.F <stdio.h>
of pertinent
macro definitions.
The functions and constants mentioned in sections labeled 3S
are declared in the include file
and need no further declaration.
The constants, and the following `functions' are
implemented as macros:
.I getc,
.I getchar,
.I putc,
.I putchar,
.I feof,
.I ferror,
.IR fileno .
.SH "SEE ALSO"
.IR printf (3),
.IR scanf (3),
.IR fopen (3),
.IR getc (3),
.IR fgets (3),
.IR fread (3),
.IR fseek (3),
.IR ungetc (3),
.IR popen (3),
.IR setbuf (3),
.IR ferror (3)
.br
.IR open (2), 
.IR read (2), 
.IR fio (3)
.SH DIAGNOSTICS
The value
.B EOF
is returned uniformly to indicate that a
.B FILE
pointer has not been initialized with
.I fopen,
input (output) has been attempted on an output (input) stream,
or a
.B FILE
pointer designates corrupt or otherwise unintelligible
.B FILE
data.
.SH BUGS
Buffering of output can prevent output data
from being seen until long after it is computed \- perhaps
never, as when an abort occurs between buffer filling and flushing.
.br
Buffering of input can cause a process to consume
more input than it actually uses.
This can cause trouble across
.IR exec (2)
or
.IR system (3)
calls.
.br
BUffering may delay the receipt of a write error until a subsequent
.I stdio
writing, seeking, or file-closing call.