gets function
gets is used to read a line of data from
STDIN. By default STDIN is the
keyboard. gets continues to read characters until NEWLINE or EOF
is seen.
Library: stdio.h
Prototype: char *gets(char *s);
Syntax: char read_line[80];
gets( read_line);
Notes
- gets does NOT check the size of the buffer and overflow on the
stack can occour. Because of this, you should use
fgets in preferance.
- The
NEWLINE
character is NOT placed in the buffer.
fgets will retain the
NEWLINE.
example
showing fgets and gets in action.
See Also: