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
|