Item Value
Header filestdio.h
Declarationchar *gets(char *str);
Functionreads characters from stdin. The newline character is translated into a null to terminate the string.
Returna null pointer on failure.
You cannot limit the number of characters that gets() will read.
#include
#include
int main(void)
{
char fname[128];
printf("Enter filename: ");
gets(fname);
printf("%s \n", fname);
return 0;
}
Enter filename: 321
321