TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: ROGER SCUDDER
from: DAVID VAN HOOSE
date: 1998-03-29 13:25:00
subject: reading input from stdin (was: I`m an id13:25:0003/29/98

-> DVH> char name[40];
-> DVH> gets(name);
-> DVH> name[40]='\n';
->
-> DVH> You have to put a NULL on the end or it will have an overflow
-> problem.
-> So then why did you put a newline on the end?
That was supposed to look like:
char name[41];
gets(name);
name[41]='\0';
printf("%s",name);
My bad.
-Dave
1:3612/333
333:1/1
davidvh@ibm.net
--- PCBoard (R) v15.3/100
---------------
* Origin: Destiny BBS: LightBar Central (1:3612/333)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.