Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | Richard <rgrdev_@gmail.com> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: cpy functions |
| Date | 2014-04-29 00:20 +0200 |
| Organization | http://www.ieee.org/ |
| Message-ID | <87bnvl3xld.fsf@gmail.com> (permalink) |
| References | <ljmdfj$su4$1@dont-email.me> <p4ftl9p41bj9nktk2b71lqfgbeuq2jseg0@4ax.com> <ljmfuf$fkm$1@dont-email.me> <psgtl9ptuqkd1bs2bo0a2nli40ujistbhe@4ax.com> |
Geoff <geoff@invalid.invalid> writes: > On Mon, 28 Apr 2014 17:07:31 -0400, "Bill Cunningham" > <nospam@nspam.invalid> wrote: > >> >>"Geoff" <geoff@invalid.invalid> 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)); > WTF!---------------^^^ > > That is wrong on two levels: > 1. You don't SUM two lengths to get the destination length. > 2. You don't SUM two pointers to get the length of anything. > >> >>Is that a "strcpy" like representation? Atleast to an extent. >> > No, it's not even close. > If you are going to use strings explicitly then use strcpy. LOL! You're not serious are you? -- "Avoid hyperbole at all costs, its the most destructive argument on the planet" - Mark McIntyre in comp.lang.c
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
cpy functions "Bill Cunningham" <nospam@nspam.invalid> - 2014-04-28 16:25 -0400
Re: cpy functions John Gordon <gordon@panix.com> - 2014-04-28 20:42 +0000
Re: cpy functions "Bill Cunningham" <nospam@nspam.invalid> - 2014-04-28 16:54 -0400
Re: cpy functions Ben Bacarisse <ben.usenet@bsb.me.uk> - 2014-04-28 22:22 +0100
Re: cpy functions "Bill Cunningham" <nospam@nspam.invalid> - 2014-04-28 17:26 -0400
Re: cpy functions Richard <rgrdev_@gmail.com> - 2014-04-29 00:19 +0200
Re: cpy functions Andrew Smallshaw <andrews@sdf.lonestar.org> - 2014-04-28 20:44 +0000
Re: cpy functions Keith Thompson <kst-u@mib.org> - 2014-04-28 14:44 -0700
Re: cpy functions Geoff <geoff@invalid.invalid> - 2014-04-28 13:55 -0700
Re: cpy functions "Bill Cunningham" <nospam@nspam.invalid> - 2014-04-28 17:07 -0400
Re: cpy functions Geoff <geoff@invalid.invalid> - 2014-04-28 14:13 -0700
Re: cpy functions "Bill Cunningham" <nospam@nspam.invalid> - 2014-04-28 17:22 -0400
Re: cpy functions "Bill Cunningham" <nospam@nspam.invalid> - 2014-04-28 17:32 -0400
Re: cpy functions "Bill Cunningham" <nospam@nspam.invalid> - 2014-04-28 18:17 -0400
Re: cpy functions jacob navia <jacob@spamsink.net> - 2014-04-29 00:43 +0200
Re: cpy functions "Bill Cunningham" <nospam@nspam.invalid> - 2014-04-28 19:31 -0400
Re: cpy functions Ian Collins <ian-news@hotmail.com> - 2014-04-29 11:33 +1200
Re: cpy functions Richard <rgrdev_@gmail.com> - 2014-04-29 02:27 +0200
Re: cpy functions Barry Schwarz <schwarzb@dqel.com> - 2014-04-28 15:53 -0700
Re: cpy functions "Bill Cunningham" <nosapm@nspam.invalid> - 2014-04-29 17:27 -0400
Re: cpy functions Kaz Kylheku <kaz@kylheku.com> - 2014-04-28 21:55 +0000
Re: cpy functions jacob navia <jacob@spamsink.net> - 2014-04-29 00:40 +0200
Re: cpy functions Richard <rgrdev_@gmail.com> - 2014-04-29 00:20 +0200
Re: cpy functions Ike Naar <ike@iceland.freeshell.org> - 2014-04-28 21:48 +0000
Re: cpy functions Richard <rgrdev_@gmail.com> - 2014-04-29 00:20 +0200
Re: cpy functions Barry Schwarz <schwarzb@dqel.com> - 2014-04-28 15:49 -0700
Re: cpy functions "Bill Cunningham" <nospam@nspam.invalid> - 2014-04-28 19:33 -0400
Re: cpy functions Ben Bacarisse <ben.usenet@bsb.me.uk> - 2014-04-28 22:13 +0100
Re: cpy functions Keith Thompson <kst-u@mib.org> - 2014-04-28 14:19 -0700
Re: cpy functions "Bill Cunningham" <nospam@nspam.invalid> - 2014-04-28 17:34 -0400
Re: cpy functions "Bill Cunningham" <nospam@nspam.invalid> - 2014-04-28 17:44 -0400
Re: cpy functions Barry Schwarz <schwarzb@dqel.com> - 2014-04-28 15:55 -0700
Re: cpy functions Kaz Kylheku <kaz@kylheku.com> - 2014-04-28 23:19 +0000
Re: cpy functions "Bill Cunningham" <nospam@nspam.invalid> - 2014-04-28 19:24 -0400
Re: cpy functions "Bill Cunningham" <nospam@nspam.invalid> - 2014-04-28 19:26 -0400
Re: cpy functions "Bill Cunningham" <nospam@nspam.invalid> - 2014-04-28 20:07 -0400
Re: cpy functions "Bill Cunningham" <nosapm@nspam.invalid> - 2014-04-29 17:30 -0400
Re: cpy functions Barry Schwarz <schwarzb@dqel.com> - 2014-04-28 15:43 -0700
Re: cpy functions "Bill Cunningham" <nospam@nspam.invalid> - 2014-04-28 19:17 -0400
Re: cpy functions "Bill Cunningham" <nospam@nspam.invalid> - 2014-04-28 19:35 -0400
Re: cpy functions Michael Angelo Ravera <maravera@prodigy.net> - 2014-04-29 03:07 -0700
Re: cpy functions Richard <rgrdev_@gmail.com> - 2014-04-29 12:59 +0200
Re: cpy functions Ben Bacarisse <ben.usenet@bsb.me.uk> - 2014-04-29 13:58 +0100
csiph-web