std::gets

From cppreference.com
< cpp‎ | io‎ | c
 
 
Input/output library
I/O manipulators
C-style I/O
Buffers
(deprecated in C++98)
Streams
Abstractions
File I/O
String I/O
Array I/O
(deprecated in C++98)
(deprecated in C++98)
(deprecated in C++98)
Synchronized Output
Types
Error category interface
(C++11)
 
 
Defined in header <cstdio>
char* gets( char* str );
(deprecated in C++11)
(removed in C++14)

Reads stdin into given character string until a newline character is found or end-of-file occurs.

Parameters

str - character string to be written

Return value

str on success, NULL on failure.

If the failure has been caused by end of file condition, additionally sets the eof indicator (see std::feof()) on stdin. If the failure has been caused by some other error, sets the error indicator (see std::ferror()) on stdin.

Notes

The function provides no means to prevent buffer overflow of the destination array, given sufficiently long input string. std::gets was deprecated in C++11 and removed from C++14.

std::fgets can be used instead.

See also

reads formatted input from stdin, a file stream or a buffer
(function)
gets a character string from a file stream
(function)
writes a character string to a file stream
(function)