1GETC(3S) GETC(3S)
2
3
4
6 getc, getchar, fgetc, getw - get character or word from stream
7
9 #include <stdio.h>
10
11 int getc(stream)
12 FILE *stream;
13
14 int getchar()
15
16 int fgetc(stream)
17 FILE *stream;
18
19 int getw(stream)
20 FILE *stream;
21
23 Getc returns the next character from the named input stream.
24
25 Getchar() is identical to getc(stdin).
26
27 Fgetc behaves like getc, but is a genuine function, not a macro; it may
28 be used to save object text.
29
30 Getw returns the next word from the named input stream. It returns the
31 constant EOF upon end of file or error, but since that is a good inte‐
32 ger value, feof and ferror(3) should be used to check the success of
33 getw. Getw assumes no special alignment in the file.
34
36 fopen(3), putc(3), gets(3), scanf(3), fread(3), ungetc(3)
37
39 These functions return the integer constant EOF at end of file or upon
40 read error.
41
42 A stop with message, `Reading bad file', means an attempt has been made
43 to read from a stream that has not been opened for reading by fopen.
44
46 The end-of-file return from getchar is incompatible with that in UNIX
47 editions 1-6.
48
49 Because it is implemented as a macro, getc treats a stream argument
50 with side effects incorrectly. In particular, `getc(*f++);' doesn't
51 work sensibly.
52
53
54
55 GETC(3S)