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