gets — get a string from standard input (DEPRECATED)
Never use this function.
gets() reads a line from
stdin into the buffer pointed to
s until either a
terminating newline or
which it replaces with a null byte ('\0'). No check for
buffer overrun is performed (see BUGS below).
s on success, and NULL on error
or when end of file occurs while no characters have been
read. However, given the lack of buffer overrun checking,
there can be no guarantees that the function will even
For an explanation of the terms used in this section, see attributes(7).
C89, C99, POSIX.1-2001.
obsolescent. ISO C11 removes the specification of
gets() from the C language, and
since version 2.16, glibc header files don't expose the
function declaration if the
_ISOC11_SOURCE feature test macro is
gets(). Because it
is impossible to tell without knowing the data in advance how
read, and because
continue to store characters past the end of the buffer, it
is extremely dangerous to use. It has been used to break
computer security. Use
For more information, see CWE-242 (aka "Use of Inherently Dangerous Function") at http://cwe.mitre.org/data/definitions/242.html
This page is part of release 4.07 of the Linux
man-pages project. A
description of the project, information about reporting bugs,
and the latest version of this page, can be found at
Copyright (c) 1993 by Thomas Koenig (ig25rz.uni-karlsruhe.de)
Permission is granted to make and distribute verbatim copies of this
manual provided the copyright notice and this permission notice are
preserved on all copies.
Permission is granted to copy and distribute modified versions of this
manual under the conditions for verbatim copying, provided that the
entire resulting derived work is distributed under the terms of a
permission notice identical to this one.
Since the Linux kernel and libraries are constantly changing, this
manual page may be incorrect or out-of-date. The author(s) assume no
responsibility for errors or omissions, or for damages resulting from
the use of the information contained herein. The author(s) may not
have taken the same level of care in the production of this manual,
which is licensed free of charge, as they might when working
Formatted or processed versions of this manual, if unaccompanied by
the source, must acknowledge the copyright and authors of this work.
Modified Wed Jul 28 11:12:07 1993 by Rik Faith (faithcs.unc.edu)
Modified Fri Sep 8 15:48:13 1995 by Andries Brouwer (aebcwi.nl)
Modified 2013-12-31, David Malcolm <dmalcolmredhat.com>
Split gets(3) into its own page; fgetc() et al. move to fgetc(3)