Definition | #include <stdio.h> char *gets(char *s);
| |
Return val. | Pointer to the result string | |
if successful. | ||
NULL pointer | if end of file is reached or a read error occurs. | |
Notes | You must explicitly provide the area in which In contrast to You can satisfy the EOF condition when reading from the terminal by means of the following | |
Example | The following program reads strings from the standard input and writes them to the #include <stdio.h> int main(void) { char s[BUFSIZ]; while(gets(s) != NULL) puts(s); return 0; } | |
See also | fgets, puts, fputs, getws |