Thread: gets() not so bad

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #11
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    Unless you can predict their input data, then certainly don't ignore the fact they're using gets(). There's really no reason to use it, or ignore the fact someone else is using it. In most cases, it could be fixed by a simple regex find-and-replace. In VIM:

    Code:
    :%s/gets(\(.*\))/fgets(\1, sizeof(\1), stdin)/gc
    And that took all of 5 seconds to come up with. Not only is there no reason for not using gets(), there's also no reason to leave it there.
    Last edited by zacs7; 06-10-2010 at 07:17 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. bad and fail of steam
    By George2 in forum C++ Programming
    Replies: 8
    Last Post: 02-19-2008, 03:07 AM
  2. Can you still view the bios screen with a bad CPU?
    By HyperCreep in forum Tech Board
    Replies: 4
    Last Post: 12-31-2006, 06:57 PM
  3. Replies: 6
    Last Post: 11-12-2005, 11:57 AM
  4. Bad coding habits
    By Magos in forum A Brief History of Cprogramming.com
    Replies: 14
    Last Post: 09-12-2005, 05:44 PM
  5. Shocking(kind of)
    By Shadow in forum A Brief History of Cprogramming.com
    Replies: 25
    Last Post: 12-10-2002, 08:52 PM