home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / lang / c / 18846 < prev    next >
Encoding:
Text File  |  1992-12-23  |  1.6 KB  |  39 lines

  1. Newsgroups: comp.lang.c
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!cs.utexas.edu!convex!constellation!osuunx.ucc.okstate.edu!olesun!gcouger
  3. From: gcouger@olesun.okstate.edu (Gordon Couger)
  4. Subject: Re: definition of strncpy stupid?
  5. Message-ID: <1992Dec24.001912.14102@osuunx.ucc.okstate.edu>
  6. Sender: news@osuunx.ucc.okstate.edu (USENET News System)
  7. Nntp-Posting-Host: olesun.agen.okstate.edu
  8. Organization: Oklahoma State University, Stillwater
  9. References: <1992Dec8.181543.15339@dnbf01.bram.cdx.mot.com> <1992Dec9.144743.1863@rti.rti.org> <16298@goanna.cs.rmit.oz.au>
  10. Date: Thu, 24 Dec 1992 00:19:12 GMT
  11. Lines: 26
  12.  
  13. In article <16298@goanna.cs.rmit.oz.au> ok@goanna.cs.rmit.oz.au (Richard A. O'Keefe) writes:
  14. >I realise this thread has been running for a while, but I think I have
  15. >something new to say
  16. >
  17. >
  18. >In article <1992Dec9.144743.1863@rti.rti.org>, jbs@rti.rti.org writes:
  19. >> In article <1992Dec9.012534.15596@ptsfa.PacBell.COM> dmturne@PacBell.COM (Dave Turner) writes:
  20. >> >>
  21. >> >>I agree with the original poster in that there's a need for a function like
  22. >> >>strncpy() but that null-terminates the target string. I find it a pain in
  23. >> >
  24. >
  25. char *strncpy(char *d,char *s, int count)
  26.     {
  27.     while(*s && count--)
  28.        *d++ = *s++;
  29.     return d
  30.     }
  31. If memory serves me this should do the trick. One of the neatest things
  32. about C is if doesn't suit you you can fix to do what ever you want it
  33. to do. Right or wrong C doesn't care.
  34. Gordon
  35.  
  36. Gordon Couger
  37. AB5Dg   Agriculture Engineering Oklahoma State University
  38. gcouger@olesun.agen.okstate.edu 405-744-6514 day 744-2794 evenings   
  39.