source: trunk/minix/man/man3/getc.3@ 20

Last change on this file since 20 was 9, checked in by Mattia Monga, 14 years ago

Minix 3.1.2a

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