Article View: comp.std.c
Article #3047Re: definition of strNcpy
From: Larry Jones
Date: Fri, 18 Dec 1992 15:49
Date: Fri, 18 Dec 1992 15:49
19 lines
1194 bytes
1194 bytes
In article <1992Dec18.015228.6094@dms.agames.com>, lipson@dms.agames.com (Pete Lipson) writes: > if you say: strncpy(dst,"abcdef",4) > > does the standard really say you get five characters appended to the > dst (the chars 'a' 'b' 'c' 'd' AND the '\0') ??? You talk about strncpy, but then you talk about characters being appended; are you really talking about strncpy() or did you mean strncat()?!? If you really mean strncpy(), then it should replace the first four characters of dst with 'a', 'b', 'c', and 'd' with no NUL. If you mean strncat(), then what you described is exactly right: it should append at most 4 characters and then add a NUL. ---- Larry Jones, SDRC, 2000 Eastman Dr., Milford, OH 45150-2789 513-576-2070 larry.jones@sdrc.com or ...uunet!sdrc!larry.jones Well of course the zipper's going to get stuck if everyone stands around WATCHING me! -- Calvin
Technical Details
Message-ID:
<2412@sdrc.COM>Path:
arc1-ca.pugleaf.net!sparky!uunet!sdrc!thor!scjonesReferences:
<1992Dec18.015228.6094@dms.agames.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!sdrc!thor!scjones From: scjones@thor.sdrc.com (Larry Jones) Newsgroups: comp.std.c Subject: Re: definition of strNcpy Message-ID: <2412@sdrc.COM> Date: 18 Dec 92 15:49:46 GMT References: <1992Dec18.015228.6094@dms.agames.com> Sender: news@sdrc.COM Lines: 19