1 .\" Copyright (c) 1993 by Thomas Koenig (ig25@rz.uni-karlsruhe.de)
3 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
5 .\" Modified Wed Jul 28 11:12:07 1993 by Rik Faith (faith@cs.unc.edu)
6 .\" Modified Fri Sep 8 15:48:13 1995 by Andries Brouwer (aeb@cwi.nl)
7 .TH fgetc 3 (date) "Linux man-pages (unreleased)"
9 fgetc, fgets, getc, getchar, ungetc \- input of characters and strings
12 .RI ( libc ", " \-lc )
17 .BI "int fgetc(FILE *" stream );
18 .BI "int getc(FILE *" stream );
19 .B "int getchar(void);"
21 .BI "char *fgets(char *restrict " s ", int " size ", FILE *restrict " stream );
23 .BI "int ungetc(int " c ", FILE *" stream );
27 reads the next character from
35 on end of file or error.
40 except that it may be implemented as a macro which evaluates
46 .BI "getc(" stdin ) \fR.
49 reads in at most one less than
53 and stores them into the buffer pointed to by
55 Reading stops after an
58 If a newline is read, it is stored into the buffer.
59 A terminating null byte (\(aq\e0\(aq)
60 is stored after the last character in the buffer.
69 where it is available for subsequent read operations.
70 Pushed-back characters
71 will be returned in reverse order; only one pushback is guaranteed.
73 Calls to the functions described here can be mixed with each other and with
74 calls to other input functions from the
76 library for the same input stream.
78 For nonlocking counterparts, see
79 .BR unlocked_stdio (3).
85 return the character read as an
91 on end of file or error.
97 on error or when end of file occurs while no characters have been read.
106 For an explanation of the terms used in this section, see
114 Interface Attribute Value
121 T} Thread safety MT-Safe
127 POSIX.1-2001, POSIX.1-2008, C89, C99.
129 It is not advisable to mix calls to input functions from the
131 library with low-level calls to
133 for the file descriptor associated with the input stream; the results
134 will be undefined and very probably not what you want.
150 .BR unlocked_stdio (3),
151 .BR feature_test_macros (7)