Reads a line from the standard input (stdin). Format #include <stdio.h> char *gets (char *str);
1 – Function Variants
The gets function has variants named _gets32 and _gets64 for use with 32-bit and 64-bit pointer sizes, respectively.
2 – Argument
str A pointer to a character string that is large enough to hold the information fetched from stdin.
3 – Description
The new-line character (\n) that ends the line is replaced by the function with an ASCII null character (\0). When stdin is opened in record mode, gets treats the end of a record the same as a new-line character and, therefore, reads up to and including a new-line character or to the end of the record.
4 – Return Values
x A pointer to the str argument. NULL Indicates that an error has occurred or that the end-of-file was encountered before a new- line character was encountered. The contents of str are undefined if a read error occurs.