1GETC(3P) POSIX Programmer's Manual GETC(3P)
2
3
4
6 This manual page is part of the POSIX Programmer's Manual. The Linux
7 implementation of this interface may differ (consult the corresponding
8 Linux manual page for details of Linux behavior), or the interface may
9 not be implemented on Linux.
10
12 getc - get a byte from a stream
13
15 #include <stdio.h>
16
17 int getc(FILE *stream);
18
19
21 The getc() function shall be equivalent to fgetc(), except that if it
22 is implemented as a macro it may evaluate stream more than once, so the
23 argument should never be an expression with side effects.
24
26 Refer to fgetc().
27
29 Refer to fgetc().
30
31 The following sections are informative.
32
34 None.
35
37 If the integer value returned by getc() is stored into a variable of
38 type char and then compared against the integer constant EOF, the com‐
39 parison may never succeed, because sign-extension of a variable of type
40 char on widening to integer is implementation-defined.
41
42 Since it may be implemented as a macro, getc() may treat incorrectly a
43 stream argument with side effects. In particular, getc(*f++) does not
44 necessarily work as expected. Therefore, use of this function should
45 be preceded by "#undef getc" in such situations; fgetc() could also be
46 used.
47
49 None.
50
52 None.
53
55 fgetc(), the Base Definitions volume of IEEE Std 1003.1-2001, <stdio.h>
56
58 Portions of this text are reprinted and reproduced in electronic form
59 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
60 -- Portable Operating System Interface (POSIX), The Open Group Base
61 Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
62 Electrical and Electronics Engineers, Inc and The Open Group. In the
63 event of any discrepancy between this version and the original IEEE and
64 The Open Group Standard, the original IEEE and The Open Group Standard
65 is the referee document. The original Standard can be obtained online
66 at http://www.opengroup.org/unix/online.html .
67
68
69
70IEEE/The Open Group 2003 GETC(3P)