2 .\" Copyright (c) 1993 by Thomas Koenig (ig25@rz.uni-karlsruhe.de)
4 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
6 .\" Modified Wed Jul 28 11:12:07 1993 by Rik Faith (faith@cs.unc.edu)
7 .\" Modified Fri Sep 8 15:48:13 1995 by Andries Brouwer (aeb@cwi.nl)
8 .TH fgetc 3 (date) "Linux man-pages (unreleased)"
10 fgetc, fgets, getc, getchar, ungetc \- input of characters and strings
13 .RI ( libc ", " \-lc )
18 .BI "int fgetc(FILE *" stream );
19 .BI "int getc(FILE *" stream );
20 .B "int getchar(void);"
22 .BI "char *fgets(char " s "[restrict ." size "], int " size ", \
23 FILE *restrict " stream );
25 .BI "int ungetc(int " c ", FILE *" stream );
29 reads the next character from
37 on end of file or error.
42 except that it may be implemented as a macro which evaluates
48 .BI "getc(" stdin ) \fR.
51 reads in at most one less than
55 and stores them into the buffer pointed to by
57 Reading stops after an
60 If a newline is read, it is stored into the buffer.
61 A terminating null byte (\[aq]\e0\[aq])
62 is stored after the last character in the buffer.
71 where it is available for subsequent read operations.
72 Pushed-back characters
73 will be returned in reverse order; only one pushback is guaranteed.
75 Calls to the functions described here can be mixed with each other and with
76 calls to other input functions from the
78 library for the same input stream.
80 For nonlocking counterparts, see
81 .BR unlocked_stdio (3).
87 return the character read as an
93 on end of file or error.
99 on error or when end of file occurs while no characters have been read.
108 For an explanation of the terms used in this section, see
116 Interface Attribute Value
123 T} Thread safety MT-Safe
129 POSIX.1-2001, POSIX.1-2008, C99.
131 It is not advisable to mix calls to input functions from the
133 library with low-level calls to
135 for the file descriptor associated with the input stream; the results
136 will be undefined and very probably not what you want.
152 .BR unlocked_stdio (3),
153 .BR feature_test_macros (7)