handle exponents greater than 2 digits
[unix-history] / usr / src / lib / libc / stdio / getc.3
... / ...
CommitLineData
1.\" @(#)getc.3 6.2 (Berkeley) %G%
2.\"
3.TH GETC 3S ""
4.AT 3
5.SH NAME
6getc, getchar, fgetc, getw \- get character or word from stream
7.SH SYNOPSIS
8.B #include <stdio.h>
9.PP
10.B int getc(stream)
11.br
12.SM
13.B FILE
14.B *stream;
15.PP
16.B int getchar()
17.PP
18.B int fgetc(stream)
19.br
20.SM
21.B FILE
22.B *stream;
23.PP
24.B int getw(stream)
25.br
26.SM
27.B FILE
28.B *stream;
29.SH DESCRIPTION
30.I Getc
31returns the next character from the named input
32.IR stream .
33.PP
34.IR Getchar ()
35is identical to
36.IR getc ( stdin ) .
37.PP
38.I Fgetc
39behaves like
40.IR getc ,
41but is a genuine function, not a macro;
42it may be used to save object text.
43.PP
44.I Getw
45returns the next
46.B int
47(a 32-bit integer on a VAX-11) from the named input
48.IR stream .
49It returns the constant
50.SM
51.B EOF
52upon end of file or error, but since that is a good
53integer value,
54.I feof
55and
56.IR ferror (3S)
57should be used to check the success of
58.IR getw .
59.I Getw
60assumes no special alignment in the file.
61.SH "SEE ALSO"
62clearerr(3S),
63fopen(3S),
64putc(3S),
65gets(3S),
66scanf(3S),
67fread(3S),
68ungetc(3S)
69.SH DIAGNOSTICS
70These functions return the integer constant
71.SM
72.B EOF
73at end of file, upon read error,
74or if an attempt is made to read a file not opened by
75.IR fopen .
76The end-of-file condition is remembered,
77even on a terminal,
78and all subsequent attempts to read will return
79.B EOF
80until the condition is cleared with
81.IR clearerr (3S).
82.SH BUGS
83Because it is implemented as a macro,
84.I getc
85treats a
86.I stream
87argument with side effects incorrectly.
88In particular,
89`getc(*f++);'
90doesn't work sensibly.