Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!mit.eternal-september.org!.POSTED!not-for-mail From: Richard Newsgroups: comp.lang.c Subject: Re: cpy functions Date: Tue, 29 Apr 2014 00:20:02 +0200 Organization: http://www.ieee.org/ Lines: 32 Message-ID: <87fvkx3xm5.fsf@gmail.com> References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mit.eternal-september.org; posting-host="07eb11d006e4bc5020972c87fef4388d"; logging-data="14278"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+Qg0egljjZbsMX63wSquWRxF3lVLPQ6ys=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) Cancel-Lock: sha1:TEqS9Z+BkYJJTSeO+n+7bJ+wk4Y= sha1:KvtdRe0jdCOjKlyr2EGeObr939w= Xref: csiph.com comp.lang.c:43758 "Bill Cunningham" writes: > "Geoff" wrote in message > news:p4ftl9p41bj9nktk2b71lqfgbeuq2jseg0@4ax.com... > > [...] > >> memcpy is somewhat more safe. Memcpy doesn't manipulate C strings, >> only bytes, it knows nothing of zero termination it copies without >> judgement of the content it's copying. It takes three arguments, a >> destination, a source and a length. As long as length is <= the size >> of destination the copy will only copy the number of bytes that >> destination is expected to hold. Of course, you can still create >> problems for yourself if the source and destinations overlap or if you >> use a length greater than the destination. > > char *a="String one"; > char *b="String two"; > > memcpy(a,b,sizeof(a+b)); > > Is that a "strcpy" like representation? Atleast to an extent. > LOL! 11/10 -- "Avoid hyperbole at all costs, its the most destructive argument on the planet" - Mark McIntyre in comp.lang.c