home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / lang / c / 12464 < prev    next >
Encoding:
Text File  |  1992-08-17  |  1.7 KB  |  38 lines

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