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

  1. Path: sparky!uunet!olivea!spool.mu.edu!umn.edu!csus.edu!netcom.com!netcomsv!dms!lipson
  2. From: lipson@dms.agames.com (Pete Lipson)
  3. Newsgroups: comp.std.c
  4. Subject: definition of strNcpy
  5. Message-ID: <1992Dec18.015228.6094@dms.agames.com>
  6. Date: 18 Dec 92 01:52:28 GMT
  7. Organization: Atari Games Corporation
  8. Lines: 18
  9. X-Newsreader: TIN [version 1.1 PL6]
  10.  
  11. i was just badly bitten by my interpretation of how strncpy works.
  12.   The MAN page for it IMPLIES that it works this way; is the standard this
  13. ambiguous too?
  14.  
  15.   if you say:   strncpy(dst,"abcdef",4)
  16.  
  17.  does the standard really say you get five characters appended to the
  18. dst (the chars 'a' 'b' 'c' 'd' AND the '\0') ???
  19.   the man-page says it moves AT MOST the count (4 in this case) characters
  20. but it ALSO says it returns a pointer to a NULL-TERMINATED result.
  21.  
  22.   I would have assumed in that case that you would have to move at most
  23. 3 non-null characters!
  24. -- 
  25.   /V\
  26. -/@-*\- Peter Lipson <-- lipson@agames.com   or   netcom!dms!lipson
  27.  \_o_/  Milpitas, CA <-- Atari Games
  28.    U
  29.