home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: sparky!uunet!wupost!sdd.hp.com!caen!nic.umass.edu!amherst!amhux1.amherst.edu!twpierce
- From: twpierce@amhux1.amherst.edu (Tim Pierce)
- Subject: Re: Allocate memory to typed in string, How?
- Message-ID: <1992Aug18.043405.10588@amhux2.amherst.edu>
- Sender: usenet@amhux2.amherst.edu (USENET News System)
- Nntp-Posting-Host: amhux1.amherst.edu
- Organization: Amherst College, Amherst MA
- References: <MJN.92Aug9012538@pseudo.uucp> <1992Aug13.184911.376@wyvern.twuug.com> <1992Aug14.194448.10225@druid.uucp>
- Date: Tue, 18 Aug 1992 04:34:05 GMT
- Lines: 25
-
- In article <1992Aug14.194448.10225@druid.uucp> darcy@druid.uucp (D'Arcy J.M. Cain) writes:
-
- >alpha@wyvern.twuug.com (Joe Wright) writes:
- >
- >>Attempts to allocate memory, char at a time, to an arbitrary 'string'
- >>is silly even if it is possible. If a string is assumed to be a line
- >>of a text file or arbitrary keyboard input, we can easily declare that
- >>it must not be longer than (let's say) 256 bytes. Given that screens
- >
- >Obviously you don't have a cat "helping" you do your input. :-) This
- >also applies to leaving a book pressing against a key. Even if only a
- >single character is allowed, accidents do happen and the system should
- >be able to cope.
-
- fgets() is excellent at this sort of thing, so you shouldn't really
- have to provide a custom-written routine to handle arbitrarily long
- strings. The question is whether you really want your application to
- handle such strings in toto; I can't think of any applications where
- this would be necessary, but I'm dubious of Joe's claim that there
- exist none.
-
- --
- ____ Tim Pierce / "Bisexual just means you pay for it."
- \ / twpierce@amherst.edu /
- \/ (BITnet: TWPIERCE@AMHERST) / -- Rock Hudson
-