Rimu Atkinson wrote in a message to Phil Ohl:
RA> use the gets() function to get a line of text from stdin.
I think there's a "don't" missing in that sentence somewhere :-)
RA> eg:
RA> char name[40];
RA> gets(name);
Oops... one sticking key or overactive user will crash/coredump/otherwise
mutilate your program.
Try:
char name[40],*p;
fgets(name,40,stdin);
/* if you wish to remove the newline to duplicate gets() functionality: */
if ((p=strchr(name,'\n'))!=NULL)
*p = '\0';
greetings,
Tom
tomtorfs@village.uunet.be
--- timEd/2 1.10+
---------------
* Origin: 80X86 BBS 32-15-24.62.32 V.34/V.FC (24h/24h) (2:292/516)
|