TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: TOM TORFS
from: DAVID VAN HOOSE
date: 1998-03-29 20:02:00
subject: reading input from stdin (was: I`m an id20:02:0003/29/98

-> First of all '\n' is not a NUL character (BTW, NULL should be used to
-> refer to a pointer, although I'm aware that in C++ you can get away
-> with it), you should use '\0' or plain 0.
Refer to a message I wrote to Roger Scudder.  I made a typo in my
example.  Again, this is what it is supposed to be:
char name[40];
gets(name);
name[40]='\0';
gets() does not using Borland, GNU, Microsoft, or Watcom compilers, put
a '\0' (NULL) on the end to signify that it has filled the character
array to the max.  Try it.. I have using straight C.
-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™.