1 .\" Copyright (c) 1993 by Thomas Koenig (ig25@rz.uni-karlsruhe.de)
3 .\" %%%LICENSE_START(VERBATIM)
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date. The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein. The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
25 .\" Modified Wed Jul 28 11:12:07 1993 by Rik Faith (faith@cs.unc.edu)
26 .\" Modified Fri Sep 8 15:48:13 1995 by Andries Brouwer (aeb@cwi.nl)
27 .TH FGETC 3 2017-09-15 "GNU" "Linux Programmer's Manual"
29 fgetc, fgets, getc, getchar, ungetc \- input of characters and strings
34 .BI "int fgetc(FILE *" stream );
36 .BI "char *fgets(char *" "s" ", int " "size" ", FILE *" "stream" );
38 .BI "int getc(FILE *" stream );
40 .B "int getchar(void);"
42 .BI "int ungetc(int " c ", FILE *" stream );
46 reads the next character from
54 on end of file or error.
59 except that it may be implemented as a macro which evaluates
65 .BI "getc(" stdin ) \fR.
68 reads in at most one less than
72 and stores them into the buffer pointed to by
74 Reading stops after an
77 If a newline is read, it is stored into the buffer.
78 A terminating null byte (\(aq\e0\(aq)
79 is stored after the last character in the buffer.
88 where it is available for subsequent read operations.
89 Pushed-back characters
90 will be returned in reverse order; only one pushback is guaranteed.
92 Calls to the functions described here can be mixed with each other and with
93 calls to other input functions from the
95 library for the same input stream.
97 For nonlocking counterparts, see
98 .BR unlocked_stdio (3).
104 return the character read as an
110 on end of file or error.
116 on error or when end of file occurs while no characters have been read.
125 For an explanation of the terms used in this section, see
131 Interface Attribute Value
139 T} Thread safety MT-Safe
143 POSIX.1-2001, POSIX.1-2008, C89, C99.
145 It is not advisable to mix calls to input functions from the
147 library with low-level calls to
149 for the file descriptor associated with the input stream; the results
150 will be undefined and very probably not what you want.
166 .BR unlocked_stdio (3),
167 .BR feature_test_macros (7)