# 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

1. 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.

2. The NEWLINE character is NOT placed in the buffer. fgets will retain the NEWLINE. example showing fgets and gets in action.

   ## See Also:

   - fgets Get a string from a file.
   - fgetc Get a character from a file.
   - fputc Put a character into a file.
   - fprintf Put a formatted line into a file.
   - fopen Open a file.
   - fclose Close a file.
   - popen Open a pipe.
   - pclose Close a pipe.

     Top | Master Index | Keywords | Functions