Gets a line from stdin and stores it in the specified location.
#include <stdio.h> char *gets (char *buffer); errno_t gets_s (char *buffer, rsize_t count);
buffer
The line consists of all characters up to and including the first newline character \n. gets replaces the newline character with a null character \0 before returning the line.
gets_s returns a pointer to the string. If end-of-file occurs before any characters are read, it returns NULL and the buffer contents remain unchanged. If an error occurs, it returns NULL and the buffer contents are indeterminate. The gets_s() function does not distinguish between end-of-file and error. Use feof or ferror to determine whether an error occurred.
Versions | Defined in | Include | Link to |
---|---|---|---|
INtime 3.0 | intime/rt/include/stdio.h | stdio.h | clib.lib |
ferror, feof, fgets, fputs, puts