View Single Post
  #3  
Old 09-06-2008, 06:22 AM
kodyazan kodyazan is offline
Senior Member
 
Join Date: Jul 2008
Posts: 60
Default

if you only want "abc" without enter (\n), you may use
gets(&buff[0]);
instead of
fgets(&buff[0] , Length ,stdin);

--Editing--
And be carefull when using gets().

If someone enters 500 characters, your program above, will -mostly- crash.
(gets() doesn't check buffer overflow. fgets() is safer).

Last edited by kodyazan : 09-06-2008 at 05:53 PM.
Reply With Quote