Path: utzoo!yunexus!geac!geaclib!daveb From: daveb@geaclib.UUCP (David Collier-Brown) Newsgroups: comp.sources.d Subject: Re: v05i053: A "safe" replacement for gets() Message-ID: <3439@geaclib.UUCP> Date: 22 Nov 88 02:31:43 GMT Article-I.D.: geaclib.3439 References: <6508@csli.STANFORD.EDU> Organization: GEAC Computers, Toronto, CANADA Lines: 22 From article <6508@csli.STANFORD.EDU>, by gandalf@csli.STANFORD.EDU (Juergen Wagner): > I am wondering how long the discussion will last... The alternatives were: [ several alternatives] > o replace gets by something more intelligent > We arrive at fgets. The "more intelligent" will certainly mean some kind > of overflow checking. That's already available in fgets. o replace gets with something much more intelligent. You hack up a copy of getline((:-)) to use a hidden buffer, strip \n and read from stdin. --dave () c-b ps: I posted a "getline" function some months ago which just keeps reallocating space as it need it. This should NOT be a standard library function, but it could provide the means of transparently replacing gets. Of course, people will then start depending on its implementation... Sigh. -- David Collier-Brown. | yunexus!lethe!dave Interleaf Canada Inc. | 1550 Enterprise Rd. | HE's so smart he's dumb. Mississauga, Ontario | --Joyce C-B