C Standard Libraries C++
gets()
Declaration
char* gets(char* cpBuffer);
Description
This function reads a line of text into the buffer "cpBuffer" from the standard input stream "stdin." It is important to make sure that the line is not too large for the buffer. Otherwise, a buffer overrun will occur. The line of text includes all characters up to and including the endline '\
' character, which is put into the stream as a null ' ' character.
Example
#include <cstdio>
int main()
{
char caBuffer[50];
gets(caBuffer);
printf("You typed: %s\n", caBuffer);
return 0;
}
Output