gets(3)


NAME

   gets - get a string from standard input (DEPRECATED)

SYNOPSIS

   #include <stdio.h>

   char *gets(char *s);

DESCRIPTION

   Never use this function.

   gets()  reads  a  line from stdin into the buffer pointed to by s until
   either a terminating newline or EOF, which it replaces with a null byte
   ('\0').  No check for buffer overrun is performed (see BUGS below).

RETURN VALUE

   gets()  returns  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 return.

ATTRIBUTES

   For  an  explanation  of  the  terms  used   in   this   section,   see
   attributes(7).

   
   Interface  Attribute      Value   
   
   gets()     Thread safety  MT-Safe 
   

CONFORMING TO

   C89, C99, POSIX.1-2001.

   LSB deprecates gets().  POSIX.1-2008 marks gets() 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 defined.

BUGS

   Never use gets().  Because it is impossible to tell without knowing the
   data  in  advance  how  many  characters  gets() will read, and because
   gets() will 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 fgets() instead.

   For more information, see CWE-242 (aka  "Use  of  Inherently  Dangerous
   Function") at http://cwe.mitre.org/data/definitions/242.html

SEE ALSO

   read(2), write(2), ferror(3), fgetc(3), fgets(3), fgetwc(3), fgetws(3),
   fopen(3),  fread(3),  fseek(3),   getline(3),   getwchar(3),   puts(3),
   scanf(3), ungetwc(3), unlocked_stdio(3), feature_test_macros(7)

COLOPHON

   This  page  is  part of release 4.09 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
   https://www.kernel.org/doc/man-pages/.


More Linux Commands

manpages/encoding.3pm.html
encoding(3pm) - allows you to write your script in non-ascii
This module is deprecated under perl 5.18. It uses a mechanism provided by perl that is deprecated under 5.18 and higher, and may be removed in a future version

manpages/htpasswd2.1.html
htpasswd2(1) - Manage user files for basic authentication...
htpasswd is used to create and update the flat-files used to store usernames and password for basic authentication of HTTP users. If htpasswd cannot access a fi

manpages/j0l.3.html
j0l(3) - Bessel functions of the first kind - Linux man page
The j0() and j1() functions return Bessel functions of x of the first kind of orders 0 and 1, respectively. The jn() function returns the Bessel function of x o

manpages/snmpvacm.1.html
snmpvacm(1) - creates and maintains SNMPv3 View-based Access
snmpvacm is an SNMP application that can be used to do simple maintenance on the View-based Control Module (VACM) tables of an SNMP agent. The SNMPv3 VACM speci

manpages/mvwaddch.3ncurses.html
mvwaddch(3ncurses) - add a character (with attributes) to a
The addch, waddch, mvaddch and mvwaddch routines put the character ch into the given window at its current window position, which is then advanced. They are ana

manpages/cytune.8.html
cytune(8) - tune driver parameters for Cyclades-Z multiport
cytune queries and modifies the interruption threshold for the Cyclades driver. Each serial line on a Cyclades card has a 12-byte FIFO for input (and another 12

manpages/set_tid_address.2.html
set_tid_address(2) - set pointer to thread ID (Man Page)....
For each process, the kernel maintains two attributes (addresses) called set_child_tid and clear_child_tid. These two attributes contain the value NULL by defau

manpages/pwrite.2.html
pwrite(2) - read from or write to a file descriptor at a giv
pread() reads up to count bytes from file descriptor fd at offset offset (from the start of the file) into the buffer starting at buf. The file offset is not ch

manpages/idmapd.conf.5.html
idmapd.conf(5) - (unknown subject) - Linux manual page......
The idmapd.conf configuration file consists of several sections, initiated by strings of the form [General] and [Mapping]. Each section may contain lines of the

manpages/pow10.3.html
pow10(3) - base-10 power functions - Linux manual page......
The pow10() function returns the value of 10 raised to the power x. VERSIONS These functions first appeared in glibc in version 2.1. CONFORMING TO This is a GNU

manpages/TYPE_ALNUM.3form.html
TYPE_ALNUM(3form) - form system global variables (Man Page)
These are building blocks for the form library, defining fields that can be created using set_fieldtype(3X). Each provides functions for field- and character-va

manpages/thread.n.html
thread(n) Extension for script access to Tcl threading......
The thread extension creates threads that contain Tcl interpreters, and it lets you send scripts to those threads for evaluation. Additionaly, it provides scrip





We can't live, work or learn in freedom unless the software we use is free.