home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / std / c / 3238 < prev    next >
Encoding:
Internet Message Format  |  1992-12-21  |  1.1 KB

  1. Path: sparky!uunet!sdrc!thor!scjones
  2. From: scjones@thor.sdrc.com (Larry Jones)
  3. Newsgroups: comp.std.c
  4. Subject: Re: definition of strNcpy
  5. Message-ID: <2412@sdrc.COM>
  6. Date: 18 Dec 92 15:49:46 GMT
  7. References: <1992Dec18.015228.6094@dms.agames.com>
  8. Sender: news@sdrc.COM
  9. Lines: 19
  10.  
  11. In article <1992Dec18.015228.6094@dms.agames.com>, lipson@dms.agames.com (Pete Lipson) writes:
  12. >   if you say:   strncpy(dst,"abcdef",4)
  13. >  does the standard really say you get five characters appended to the
  14. > dst (the chars 'a' 'b' 'c' 'd' AND the '\0') ???
  15.  
  16. You talk about strncpy, but then you talk about characters being appended;
  17. are you really talking about strncpy() or did you mean strncat()?!?
  18.  
  19. If you really mean strncpy(), then it should replace the first four
  20. characters of dst with 'a', 'b', 'c', and 'd' with no NUL.
  21.  
  22. If you mean strncat(), then what you described is exactly right: it
  23. should append at most 4 characters and then add a NUL.
  24. ----
  25. Larry Jones, SDRC, 2000 Eastman Dr., Milford, OH  45150-2789  513-576-2070
  26. larry.jones@sdrc.com  or  ...uunet!sdrc!larry.jones
  27. Well of course the zipper's going to get stuck if everyone
  28. stands around WATCHING me! -- Calvin
  29.