4.3BSD/usr/man/man3/getc.3s

.\"	@(#)getc.3s	6.2 (Berkeley) 5/14/86
.\"
.TH GETC 3S  "May 14, 1986"
.AT 3
.SH NAME
getc, getchar, fgetc, getw \- get character or word from stream
.SH SYNOPSIS
.B #include <stdio.h>
.PP
.B int getc(stream)
.br
.SM
.B FILE
.B *stream;
.PP
.B int getchar()
.PP 
.B int fgetc(stream)
.br
.SM
.B FILE
.B *stream;
.PP
.B int getw(stream)
.br
.SM
.B FILE
.B *stream;
.SH DESCRIPTION
.I Getc
returns the next character from the named input
.IR stream .
.PP
.IR Getchar ()
is identical to 
.IR getc ( stdin ) .
.PP
.I Fgetc
behaves like 
.IR getc ,
but is a genuine function, not a macro;
it may be used to save object text.
.PP
.I Getw
returns the next
.B int
(a 32-bit integer on a VAX-11) from the named input
.IR stream .
It returns the constant
.SM
.B EOF
upon end of file or error, but since that is a good
integer value,
.I feof
and
.IR  ferror (3S)
should be used to check the success of
.IR getw .
.I Getw
assumes no special alignment in the file.
.SH "SEE ALSO"
clearerr(3S),
fopen(3S),
putc(3S),
gets(3S),
scanf(3S),
fread(3S),
ungetc(3S)
.SH DIAGNOSTICS
These functions return the integer constant
.SM
.B EOF
at end of file, upon read error,
or if an attempt is made to read a file not opened by
.IR fopen .
The end-of-file condition is remembered,
even on a terminal,
and all subsequent attempts to read will return
.B EOF
until the condition is cleared with
.IR clearerr (3S).
.SH BUGS
Because it is implemented as a macro,
.I getc
treats a
.I stream
argument with side effects incorrectly.
In particular,
`getc(*f++);'
doesn't work sensibly.