|
|
1.1 root 1: .TH GETC 3S "19 January 1983"
2: .SH NAME
3: getc, getchar, fgetc, getw \- get character or word from stream
4: .SH SYNOPSIS
5: .B #include <stdio.h>
6: .PP
7: .B int getc(stream)
8: .br
9: .SM
10: .B FILE
11: .B *stream;
12: .PP
13: .B int getchar()
14: .PP
15: .B int fgetc(stream)
16: .br
17: .SM
18: .B FILE
19: .B *stream;
20: .PP
21: .B int getw(stream)
22: .br
23: .SM
24: .B FILE
25: .B *stream;
26: .SH DESCRIPTION
27: .I Getc
28: returns the next character from the named input
29: .IR stream .
30: .PP
31: .IR Getchar ()
32: is identical to
33: .IR getc ( stdin ) .
34: .PP
35: .I Fgetc
36: behaves like
37: .IR getc ,
38: but is a genuine function, not a macro;
39: it may be used to save object text.
40: .PP
41: .I Getw
42: returns the next word from the named input
43: .IR stream .
44: It returns the constant
45: .SM
46: .B EOF
47: upon end of file or error, but since that is a good
48: integer value,
49: .I feof
50: and
51: .IR ferror (3S)
52: should be used to check the success of
53: .IR getw .
54: .I Getw
55: assumes no special alignment in the file.
56: .SH "SEE ALSO"
57: fopen(3S),
58: putc(3S),
59: gets(3S),
60: scanf(3S),
61: fread(3S),
62: ungetc(3S)
63: .SH DIAGNOSTICS
64: These functions return the integer constant
65: .SM
66: .B EOF
67: at end of file or upon read error.
68: .PP
69: A stop with message,
70: `Reading bad file', means an attempt has been made to
71: read from a stream that has not been opened for
72: reading by
73: .IR fopen .
74: .SH BUGS
75: The end-of-file return from
76: .I getchar
77: is incompatible with that in UNIX editions 1-6.
78: .PP
79: Because it is implemented as a macro,
80: .I getc
81: treats a
82: .I stream
83: argument with side effects incorrectly.
84: In particular,
85: `getc(*f++);'
86: doesn't work sensibly.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.