TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: MANISH MALIK
from: ROGER SCUDDER
date: 1998-01-29 16:50:00
subject: C++ Saveding stuff

Hello Manish.
28 Jan 98 10:04, Manish Malik wrote to Cyber Con:
CC>> ok i know how you have some one enter a number
CC>> scanf , but will this work for words.
MM> for words, use "gets" function. It will give you a string with spaces, 
nd
MM> words.
 Because gets has no bounds protection, it should be avoided.
 Use fgets instead.... e.g  fgets(buffer, buffer_len, stdin);
MM> I suggest you prefer cgets(), and cputs() in conio.h (I mean..thats what 

MM> prefer).
 I think that cgets has some bounds protection, but it's only
 going to compile if you're using a Borland compiler.  If you
 want to make your code more portable use the fgets.
 Of course, C code like this is off topic and should be discussed
 in the C echo.
 -Roger
... 'If it ain't broke, you can probably still fix it.' - Tim Allen
--- Msged 4.20 beta 3
(1:273/404@fidonet)
---------------
* Origin: Hodge-Podge Support BBS, Upper Darby, Pennsylvania, USA

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™.