473,387 Members | 1,516 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

diff between memmove & memecpy

1. How would you use the functions memcpy(), memset(), memmove()?
Nov 13 '05 #1
71 4237
ROSY <de**************@rediffmail.com> scribbled the following:
1. How would you use the functions memcpy(), memset(), memmove()?


What does your C textbook say?

--
/-- Joona Palaste (pa*****@cc.helsinki.fi) ---------------------------\
| Kingpriest of "The Flying Lemon Tree" G++ FR FW+ M- #108 D+ ADA N+++|
| http://www.helsinki.fi/~palaste W++ B OP+ |
\----------------------------------------- Finland rules! ------------/
"Nothing lasts forever - so why not destroy it now?"
- Quake
Nov 13 '05 #2
In article <73**************************@posting.google.com >,
de**************@rediffmail.com says...
1. How would you use the functions memcpy(),
memcpy(bar, foo, fred);
memset(),
memset(foo, bar, fred);
memmove()?


memmove(bar, foo, fred);

Feel free to extend as you see fit to fit the needs of your specific
application.

--
Randy Howard _o
2reply remove FOOBAR \<,
______________________()/ ()______________________________________________
SCO Spam-magnet: po********@sco.com
Nov 13 '05 #3

ROSY <de**************@rediffmail.com> wrote in message
news:73**************************@posting.google.c om...
1. How would you use the functions memcpy(), memset(), memmove()?


First I'd determine whether I need to use them at all.
If so, I'd look up their documentation, and write the
code accordingly.

How would *you* do it?

-Mike

Nov 13 '05 #4
On 17 Sep 2003 01:00:51 -0700,
ROSY <de**************@rediffmail.com> wrote:

1. How would you use the functions memcpy(), memset(), memmove()?

Only one of them can reliably copy between memory areas which overlaps.

Villy
Nov 13 '05 #5
On 18 Sep 2003 07:14:29 GMT, ve*@station02.ohout.pharmapartners.nl
(Villy Kruse) wrote:
On 17 Sep 2003 01:00:51 -0700,
ROSY <de**************@rediffmail.com> wrote:

1. How would you use the functions memcpy(), memset(), memmove()?

Only one of them can reliably copy between memory areas which overlaps.

And another won't even copy memory areas.

Coos
Nov 13 '05 #6
de**************@rediffmail.com (ROSY) writes:
1. How would you use the functions memcpy(), memset(), memmove()?


Correctly. How would you use them?

--
Keith Thompson (The_Other_Keith) ks*@cts.com <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://www.sdsc.edu/~kst>
Schroedinger does Shakespeare: "To be *and* not to be"
Nov 13 '05 #7
for RANDY,
hello,
thanks 4 ur rubbish & stupid response.U just waste my valuable
time.Don't be silly guy.Take care of urself.I just believe in laugh,but
obviously not responding in this stupid way.Altime joking with allthings
not good,Damned.Also dont waste ur time & groups member.

Lastly ur really damned.
Randy Howard <ra**********@FOOmegapathdslBAR.net> wrote in message news:<MP************************@news.megapathdsl. net>...
In article <73**************************@posting.google.com >,
de**************@rediffmail.com says...
1. How would you use the functions memcpy(),


memcpy(bar, foo, fred);
memset(),


memset(foo, bar, fred);
memmove()?


memmove(bar, foo, fred);

Feel free to extend as you see fit to fit the needs of your specific
application.

Nov 13 '05 #8
ROSY <de**************@rediffmail.com> scribbled the following:
for RANDY,
hello,
thanks 4 ur rubbish & stupid response.U just waste my valuable
time.Don't be silly guy.Take care of urself.I just believe in laugh,but
obviously not responding in this stupid way.Altime joking with allthings
not good,Damned.Also dont waste ur time & groups member. Lastly ur really damned.


Well what did you expect with the kind of questions you asked? We were
led to believe you wanted us to do your homework for you.
PS. Please don't top-post.

--
/-- Joona Palaste (pa*****@cc.helsinki.fi) ---------------------------\
| Kingpriest of "The Flying Lemon Tree" G++ FR FW+ M- #108 D+ ADA N+++|
| http://www.helsinki.fi/~palaste W++ B OP+ |
\----------------------------------------- Finland rules! ------------/
"The large yellow ships hung in the sky in exactly the same way that bricks
don't."
- Douglas Adams
Nov 13 '05 #9
de**************@rediffmail.com (ROSY) wrote in message news:<73**************************@posting.google. com>...
for RANDY,
hello,
thanks 4 ur rubbish & stupid response.U just waste my valuable
time.Don't be silly guy.Take care of urself.I just believe in laugh,but
obviously not responding in this stupid way.Altime joking with allthings
not good,Damned.Also dont waste ur time & groups member.

Lastly ur really damned.


Hi Debashis,

This is certainly not the right way to respond to the newsgroup.
This is *not* the right response from the Gandhian land---the land of
love---the India.

I understand you're in the learning curve. This comp.lang.c is
filled with international experts and renowned book authors. You can
get almost all the answers by searching on the net using the very
famous search engine www.google.com Also, it is a good idea to look at
the FAQ.

I'm sure, once you became bit matured, you would certainly feel
guilty/shame to ask such questions & you would ready to ask excuse.

---
"Learn from yesterday, live for today, hope for tomorrow. The
important thing is to not stop questioning."--Albert Einstein
http://guideme.itgo.com/atozofc/ - "A to Z of C" Project
Email: rrjanbiah-at-Y!com
Nov 13 '05 #10
In article <73**************************@posting.google.com >,
de**************@rediffmail.com says...
for RANDY,
hello,
thanks 4 ur rubbish & stupid response.
You're welcome, I try to keep my responses on or above
the level of the questions. In this case, that was
extremely easy. There is a popular saying that goes
"Ask a stupid question, get a stupid answer". Your
question wasn't stupid per se, but it was so incredibly
broad ("How would you use the functions....") as to
be impossible to answer with any hope of it being of
use to you.
U just waste my valuable time. Right. I thought it was the other way around.
Don't be silly guy.Take care of urself.I just believe in laugh,but
obviously not responding in this stupid way.Altime joking with allthings
not good,Damned.Also dont waste ur time & groups member.
I'll pretend like I parsed the above correctly and just move on.
Lastly ur really damned.


Outstanding. Thanks so much.

Nov 13 '05 #11
Joona I Palaste <pa*****@cc.helsinki.fi> wrote in message news:<bk**********@oravannahka.helsinki.fi>...
ROSY <de**************@rediffmail.com> scribbled the following: PS. Please don't top-post.
http://www.faqs.org/docs/jargon/T/top-post.html This link is for
Debashis who may not be knowing what is top-post. In simpler terms,
top-post means posting answers above the questions.

[correct format...]
What is your name? Debashis

[wrong format...]

Debashis What is your name?


---
"Learn from yesterday, live for today, hope for tomorrow. The
important thing is to not stop questioning."--Albert Einstein
http://guideme.itgo.com/atozofc/ - "A to Z of C" Project
Email: rrjanbiah-at-Y!com
Nov 13 '05 #12
Randy Howard <ra**********@foomegapathdslbar.net> scribbled the following:
In article <73**************************@posting.google.com >,
de**************@rediffmail.com says...
for RANDY,
hello,
thanks 4 ur rubbish & stupid response. ^^
U just waste my valuable time. ^
Don't be silly guy.Take care of urself.I just believe in laugh,but ^^^^^^ obviously not responding in this stupid way.Altime joking with allthings
not good,Damned.Also dont waste ur time & groups member. ^^
I'll pretend like I parsed the above correctly and just move on.

Lastly ur really damned.

^^

I find it amazing how a C coder's competence is usually inversely
proportional to his/her usage of "U" and "ur" instead of "you" and
"your". Is it written somewhere in stone or is it just a rule of
thumb?
I personally find it laughable when people spend more time learing
d00dsp33k than C programming.

--
/-- Joona Palaste (pa*****@cc.helsinki.fi) ---------------------------\
| Kingpriest of "The Flying Lemon Tree" G++ FR FW+ M- #108 D+ ADA N+++|
| http://www.helsinki.fi/~palaste W++ B OP+ |
\----------------------------------------- Finland rules! ------------/
"Bad things only happen to scoundrels."
- Moominmamma
Nov 13 '05 #13
On 23 Sep 2003 19:10:59 -0700, in comp.lang.c ,
de**************@rediffmail.com (ROSY) wrote:
for RANDY,
hello,
thanks 4 ur rubbish & stupid response.U just waste my valuable
time.


But yet you think its ok to post a trivial question which wastes the
considerably more valuable time of the C regulars here, and which any
textbook would answer?

Top tip: READ A BOOK if you want to know how to answer your homework,
especially for such trivia.

By the way, Randy did in fact answer your question. What, you didn't
understand the answer? Perhaps thats because you need to learn basic C
first.
--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.angelfire.com/ms3/bchambless0/welcome_to_clc.html>
Nov 13 '05 #14
On 24 Sep 2003 12:37:34 GMT, in comp.lang.c , Joona I Palaste
<pa*****@cc.helsinki.fi> wrote:
I personally find it laughable when people spend more time learing
d00dsp33k than C programming.


I reckon there's some smart money to be made writing a new language in
d00dsp33k.... just think of all the idiots that would buy your
compiler, just so as to be up with the rest of the lusers.

"The lusers I know are so clueless, that if they were dipped in clue
musk and dropped in the middle of pack of horny clues, on clue prom
night during clue happy hour, they still couldn't get a clue."
--Michael Girdwood, in the monastery
--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.angelfire.com/ms3/bchambless0/welcome_to_clc.html>
Nov 13 '05 #15
In <bk**********@oravannahka.helsinki.fi> Joona I Palaste <pa*****@cc.helsinki.fi> writes:
I find it amazing how a C coder's competence is usually inversely
proportional to his/her usage of "U" and "ur" instead of "you" and
"your". Is it written somewhere in stone or is it just a rule of
thumb?


The actual connection is between the usage of "U" and "ur" and the
person's stupidity level. Stupid people seldom become competent C
programmers :-)

Intelligent people usually realise that such abbreviations buy them next
to nothing, but make their text look silly, so they don't use them.

It is also relatively easy to see the difference between a newbie question
posted by an intelligent person and one posted by a stupid one, even if
one ignores such "stylistical" issues.

Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: Da*****@ifh.de
Nov 13 '05 #16
ROSY wrote:
1. How would you use the functions memcpy(), memset(), memmove()?


There is also memcmp().
1. memcpy is used for copying regions of memory from one place
to another. It is not guaranteed to work when the regions
overlap. A common usage is for copying structure variables.

2. memset is used for filling locations of memory with a fixed
value. An example is filling a char array with spaces.

3. memmove is used for "moving" regions of memory from one
place to another and handles overlapping regions.

4. memcmp is used to "lexicographically" compare one region
of memory to another. The common use is to check one
region equal to another.

--
Thomas Matthews

C++ newsgroup welcome message:
http://www.slack.net/~shiva/welcome.txt
C++ Faq: http://www.parashift.com/c++-faq-lite
C Faq: http://www.eskimo.com/~scs/c-faq/top.html
alt.comp.lang.learn.c-c++ faq:
http://www.raos.demon.uk/acllc-c++/faq.html
Other sites:
http://www.josuttis.com -- C++ STL Library book

Nov 13 '05 #17
Mark McIntyre wrote:
On 24 Sep 2003 12:37:34 GMT, in comp.lang.c , Joona I Palaste
<pa*****@cc.helsinki.fi> wrote:

I personally find it laughable when people spend more time learing
d00dsp33k than C programming.

I reckon there's some smart money to be made writing a new language in
d00dsp33k.... just think of all the idiots that would buy your
compiler, just so as to be up with the rest of the lusers.


<troll>
Done. It's named Perl
</troll>

Bruno

Nov 13 '05 #18
Mark McIntyre wrote:
On 24 Sep 2003 12:37:34 GMT, in comp.lang.c , Joona I Palaste
<pa*****@cc.helsinki.fi> wrote:

I personally find it laughable when people spend more time learing
d00dsp33k than C programming.

I reckon there's some smart money to be made writing a new language in
d00dsp33k.... just think of all the idiots that would buy your
compiler, just so as to be up with the rest of the lusers.


<troll>
Done. It's named Perl
</troll>

Bruno

Nov 13 '05 #19
friends,

Well, hold it for a second and go through the below given link.

http://groups.google.com/groups?hl=e...arch%26meta%3D


ng**********@rediffmail.com (R. Rajesh Jeba Anbiah) wrote in message news:<ab**************************@posting.google. com>...
de**************@rediffmail.com (ROSY) wrote in message news:<73**************************@posting.google. com>...
for RANDY,
hello,
thanks 4 ur rubbish & stupid response.U just waste my valuable
time.Don't be silly guy.Take care of urself.I just believe in laugh,but
obviously not responding in this stupid way.Altime joking with allthings
not good,Damned.Also dont waste ur time & groups member.

Lastly ur really damned.


Hi Debashis,

This is certainly not the right way to respond to the newsgroup.
This is *not* the right response from the Gandhian land---the land of
love---the India.

I understand you're in the learning curve. This comp.lang.c is
filled with international experts and renowned book authors. You can
get almost all the answers by searching on the net using the very
famous search engine www.google.com Also, it is a good idea to look at
the FAQ.

I'm sure, once you became bit matured, you would certainly feel
guilty/shame to ask such questions & you would ready to ask excuse.

---
"Learn from yesterday, live for today, hope for tomorrow. The
important thing is to not stop questioning."--Albert Einstein
http://guideme.itgo.com/atozofc/ - "A to Z of C" Project
Email: rrjanbiah-at-Y!com

Nov 13 '05 #20
friends,

Well, hold it for a second and go through the below given link.

http://groups.google.com/groups?hl=e...arch%26meta%3D


ng**********@rediffmail.com (R. Rajesh Jeba Anbiah) wrote in message news:<ab**************************@posting.google. com>...
de**************@rediffmail.com (ROSY) wrote in message news:<73**************************@posting.google. com>...
for RANDY,
hello,
thanks 4 ur rubbish & stupid response.U just waste my valuable
time.Don't be silly guy.Take care of urself.I just believe in laugh,but
obviously not responding in this stupid way.Altime joking with allthings
not good,Damned.Also dont waste ur time & groups member.

Lastly ur really damned.


Hi Debashis,

This is certainly not the right way to respond to the newsgroup.
This is *not* the right response from the Gandhian land---the land of
love---the India.

I understand you're in the learning curve. This comp.lang.c is
filled with international experts and renowned book authors. You can
get almost all the answers by searching on the net using the very
famous search engine www.google.com Also, it is a good idea to look at
the FAQ.

I'm sure, once you became bit matured, you would certainly feel
guilty/shame to ask such questions & you would ready to ask excuse.

---
"Learn from yesterday, live for today, hope for tomorrow. The
important thing is to not stop questioning."--Albert Einstein
http://guideme.itgo.com/atozofc/ - "A to Z of C" Project
Email: rrjanbiah-at-Y!com

Nov 13 '05 #21
ROSY wrote:
Lastly ur really damned.

*plonk*


Brian Rodenborn
Nov 13 '05 #22
ROSY wrote:
Lastly ur really damned.

*plonk*


Brian Rodenborn
Nov 13 '05 #23
Debashis, do you need all this!. Think before you post anything in this group.
Nov 13 '05 #24
Debashis, do you need all this!. Think before you post anything in this group.
Nov 13 '05 #25
Joona I Palaste <pa*****@cc.helsinki.fi> spoke thus:
I find it amazing how a C coder's competence is usually inversely
proportional to his/her usage of "U" and "ur" instead of "you" and
"your". Is it written somewhere in stone or is it just a rule of
thumb?


Possibly, although a friend of mine who I think codes significantly better C
than I do is fond of the "word" neways (that's "anyways" to English speakers).

--
Christopher Benson-Manica | Jumonji giri, for honour.
ataru(at)cyberspace.org |
Nov 13 '05 #26
Joona I Palaste <pa*****@cc.helsinki.fi> spoke thus:
I find it amazing how a C coder's competence is usually inversely
proportional to his/her usage of "U" and "ur" instead of "you" and
"your". Is it written somewhere in stone or is it just a rule of
thumb?


Possibly, although a friend of mine who I think codes significantly better C
than I do is fond of the "word" neways (that's "anyways" to English speakers).

--
Christopher Benson-Manica | Jumonji giri, for honour.
ataru(at)cyberspace.org |
Nov 13 '05 #27

On Wed, 24 Sep 2003, sathyashrayan wrote:

friends,

Well, hold it for a second and go through the below given link.


[crazy-long link snipped; new link substituted]

} http://groups.google.com/groups?
} th**********************************@posting.googl e.com
Please learn to do the following:

1) Trim quotes.
2) Bottom-post.
3) Trim "Google Groups" links to normal-people length.
4) Provide some sort of context for your remarks.
5) Use c.l.c for discussion of C, not Indian educational systems.
Thanks much.
-Arthur

(Your post does demonstrate how much the c.l.c regulars like
poking fun at clueless newbies, though. :)

Nov 13 '05 #28

On Wed, 24 Sep 2003, sathyashrayan wrote:

friends,

Well, hold it for a second and go through the below given link.


[crazy-long link snipped; new link substituted]

} http://groups.google.com/groups?
} th**********************************@posting.googl e.com
Please learn to do the following:

1) Trim quotes.
2) Bottom-post.
3) Trim "Google Groups" links to normal-people length.
4) Provide some sort of context for your remarks.
5) Use c.l.c for discussion of C, not Indian educational systems.
Thanks much.
-Arthur

(Your post does demonstrate how much the c.l.c regulars like
poking fun at clueless newbies, though. :)

Nov 13 '05 #29
Thomas Matthews wrote:

ROSY wrote:
1. How would you use the functions memcpy(), memset(), memmove()?


There is also memcmp().


Are you out of your MIND !?
OP's question is CLEARLY only about the string functions
which return type pointer to void, and which have side effects.

Anyway, the answer to the question is here:

http://anubis.dkuug.dk/jtc1/sc22/wg14/www/docs/n869/

--
pete
Nov 13 '05 #30
ng**********@rediffmail.com (R. Rajesh Jeba Anbiah) writes:
Joona I Palaste <pa*****@cc.helsinki.fi> wrote in message
news:<bk**********@oravannahka.helsinki.fi>...
ROSY <de**************@rediffmail.com> scribbled the following:
PS. Please don't top-post.


http://www.faqs.org/docs/jargon/T/top-post.html This link is for
Debashis who may not be knowing what is top-post. In simpler terms,
top-post means posting answers above the questions.

[correct format...]
> What is your name?

Debashis

[wrong format...]

Debashis
> What is your name?


Except that new text should not be indented. Indentation, like "> ",
usually indicates that you're quoting something. (I usually use
4-space indentation when quoting sections of the standard, "> " when
quoting portions of a previous article.)

So the correct format is:
What is your name?

Debashis

Source code, of course, should be indented for legibility.

--
Keith Thompson (The_Other_Keith) ks*@cts.com <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://www.sdsc.edu/~kst>
Schroedinger does Shakespeare: "To be *and* not to be"
Nov 13 '05 #31
Default User <fi********@company.com> wrote in message news:<3F***************@company.com>...
ROSY wrote:
Lastly ur really damned.

*plonk*


Brian Rodenborn


I dont know why this OT is such a long one?
Nov 13 '05 #32
U want 2 answer the levels of question,i think ur rubbish again,the questions
fuck urself understand.if u take challenge then i'm going on further.But if u
dont give any response ur jugglery come 2 at an end.
Really ur fooing the bar.

Randy Howard <ra**********@FOOmegapathdslBAR.net> wrote in message news:<MP************************@news.megapathdsl. net>...
In article <73**************************@posting.google.com >,
de**************@rediffmail.com says...
for RANDY,
hello,
thanks 4 ur rubbish & stupid response.


You're welcome, I try to keep my responses on or above
the level of the questions. In this case, that was
extremely easy. There is a popular saying that goes
"Ask a stupid question, get a stupid answer". Your
question wasn't stupid per se, but it was so incredibly
broad ("How would you use the functions....") as to
be impossible to answer with any hope of it being of
use to you.
U just waste my valuable time.

Right. I thought it was the other way around.
Don't be silly guy.Take care of urself.I just believe in laugh,but
obviously not responding in this stupid way.Altime joking with allthings
not good,Damned.Also dont waste ur time & groups member.


I'll pretend like I parsed the above correctly and just move on.
Lastly ur really damned.


Outstanding. Thanks so much.

Nov 13 '05 #33
ROSY <de**************@rediffmail.com> scribbled the following:
U want 2 answer the levels of question,i think ur rubbish again,the questions
fuck urself understand.if u take challenge then i'm going on further.But if u
dont give any response ur jugglery come 2 at an end.
Really ur fooing the bar.


Were you born this ignorant, or did you have to take a course? *PLONK*

--
/-- Joona Palaste (pa*****@cc.helsinki.fi) ---------------------------\
| Kingpriest of "The Flying Lemon Tree" G++ FR FW+ M- #108 D+ ADA N+++|
| http://www.helsinki.fi/~palaste W++ B OP+ |
\----------------------------------------- Finland rules! ------------/
"'It can be easily shown that' means 'I saw a proof of this once (which I didn't
understand) which I can no longer remember'."
- A maths teacher
Nov 13 '05 #34
It is best 2 not spoke ur nose on this matter.
bye,


Mark McIntyre <ma**********@spamcop.net> wrote in message news:<ei********************************@4ax.com>. ..
On 23 Sep 2003 19:10:59 -0700, in comp.lang.c ,
de**************@rediffmail.com (ROSY) wrote:
for RANDY,
hello,
thanks 4 ur rubbish & stupid response.U just waste my valuable
time.


But yet you think its ok to post a trivial question which wastes the
considerably more valuable time of the C regulars here, and which any
textbook would answer?

Top tip: READ A BOOK if you want to know how to answer your homework,
especially for such trivia.

By the way, Randy did in fact answer your question. What, you didn't
understand the answer? Perhaps thats because you need to learn basic C
first.

Nov 13 '05 #35

On Fri, 25 Sep 2003, ROSY wrote:

It is best 2 not spoke ur nose on this matter.
bye,

Gee, all those guys who plonked ROSY don't know
what they're missing. :-)

It is probably not significant that a Google Groups
search on "author:ROSY" suggests the "Related Groups"
of comp.lang.c.* and soc.sexuality.spanking...

-Arthur,
now I'll be quiet
Nov 13 '05 #36
"ROSY" wrote on 26 Sept 03:
U want 2 answer the levels of question,i think ur rubbish again,the questions fuck urself understand.if u take challenge then i'm going on further.But if u dont give any response ur jugglery come 2 at an end.
Really ur fooing the bar.


I appreciate that English is not your first language, but could you at
least attempt to make sense when posting - even if it means asking a
friend to translate for you.

Secondly, don't swear. Though most of the readers are adults, there's
no need.

Lastly, don't top-post.

Mike

--
Michael Winter
M.Winter@[no-spam]blueyonder.co.uk (remove [no-spam] to reply)
Nov 13 '05 #37
pete wrote:
Thomas Matthews wrote:
ROSY wrote:

1. How would you use the functions memcpy(), memset(), memmove()?


There is also memcmp().

Are you out of your MIND !?
OP's question is CLEARLY only about the string functions
which return type pointer to void, and which have side effects.

Anyway, the answer to the question is here:

http://anubis.dkuug.dk/jtc1/sc22/wg14/www/docs/n869/


FYI, the mem*() functions are not string functions. The string
functions are str*(), and work with NULL terminated character
arrays.

They do have side effects, which is their behavior.

Try this one:
#include <stdio.h>
#include <string.h>

#define BUFFER_LENGTH 64

int main(void)
{
const char * test_text = "How are you?\n\0\nMr. Potato?\n";
char result[BUFFER_LENGTH];
unsigned int i;

memset(result, '\0', 256);
/* string test */
strcpy(result, test_text);
for (i = 0; i < BUFFER_LENGTH; ++i)
{
putchar(result[i]);
}

/* memcpy test */
memcpy(result, test_text, sizeof(*test_text));
for (i = 0; i < BUFFER_LENGTH; ++i)
{
putchar(result[i]);
}
return 0;
}
--
Thomas Matthews

C++ newsgroup welcome message:
http://www.slack.net/~shiva/welcome.txt
C++ Faq: http://www.parashift.com/c++-faq-lite
C Faq: http://www.eskimo.com/~scs/c-faq/top.html
alt.comp.lang.learn.c-c++ faq:
http://www.raos.demon.uk/acllc-c++/faq.html
Other sites:
http://www.josuttis.com -- C++ STL Library book

Nov 13 '05 #38
ROSY wrote:
U want 2 answer the levels of question,i think ur rubbish again,the questions
fuck urself understand.if u take challenge then i'm going on further.But if u
dont give any response ur jugglery come 2 at an end.
Really ur fooing the bar.


ROSY,

Eye relly dont unnerstan Y U abreviat the short words but spel owt
da big wons.

I guess there isn't any convenient shorthand for "jugglery" or
"challenge". By the way (BTW), you (U) can shorten the word
"question" to "q's". If you can spend the extra time to type
out "your" instead of "ur" or "to" instead of "2", please don't
bother to type.

--
Thomas Matthews

C++ newsgroup welcome message:
http://www.slack.net/~shiva/welcome.txt
C++ Faq: http://www.parashift.com/c++-faq-lite
C Faq: http://www.eskimo.com/~scs/c-faq/top.html
alt.comp.lang.learn.c-c++ faq:
http://www.raos.demon.uk/acllc-c++/faq.html
Other sites:
http://www.josuttis.com -- C++ STL Library book

Nov 13 '05 #39
Thomas Matthews <Th**********************@sbcglobal.net> writes:
[...]
I guess there isn't any convenient shorthand for "jugglery" or
"challenge". By the way (BTW), you (U) can shorten the word
"question" to "q's". If you can spend the extra time to type
out "your" instead of "ur" or "to" instead of "2", please don't
bother to type.


I guess you can also abbreviate "can't" to "can". 8-)}

--
Keith Thompson (The_Other_Keith) ks*@cts.com <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://www.sdsc.edu/~kst>
Schroedinger does Shakespeare: "To be *and* not to be"
Nov 13 '05 #40
On 25 Sep 2003 23:35:22 -0700, in comp.lang.c ,
de**************@rediffmail.com (ROSY) wrote:
It is best 2 not spoke ur nose on this matter.


don't be an idiot. This is not your private chatroom

and if you can't be polite, then you should go away.
--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.angelfire.com/ms3/bchambless0/welcome_to_clc.html>
Nov 13 '05 #41
Thomas Matthews wrote:

pete wrote:
Thomas Matthews wrote:
ROSY wrote:
1. How would you use the functions memcpy(),
memset(), memmove()?

There is also memcmp().

Are you out of your MIND !?
OP's question is CLEARLY only about the string functions
which return type pointer to void, and which have side effects.

Anyway, the answer to the question is here:

http://anubis.dkuug.dk/jtc1/sc22/wg14/www/docs/n869/


FYI, the mem*() functions are not string functions. The string
functions are str*(), and work with NULL terminated character
arrays.


Who told you that ?
N869
7.21 String handling <string.h>
7.21.1 String function conventions
[#1] The header <string.h> declares one type and several
functions, and defines one macro useful for manipulating
arrays of character type and other objects treated as arrays
of character type. The type is size_t and the macro is
NULL (both described in 7.17). Various methods are used for
determining the lengths of the arrays, but in all cases a
char * or void * argument points to the initial (lowest
addressed) character of the array. If an array is accessed
beyond the end of an object, the behavior is undefined.

void* arguments have nothing to do with any functions
that start with str*.
They do have side effects, which is their behavior.
memcmp() has no side effects, which is part of the reason
that memcmp() does not belong in the same group
of string functions, as those which OP asked about.
Try this one: #define BUFFER_LENGTH 64 char result[BUFFER_LENGTH]; memset(result, '\0', 256);


I don't think 256 is a good number to use there.
What's the point anyway ?
Your code has nothing to do with the fact that memcmp()
doesn't have side effects while memcpy(), memset(), and memmove()
do have side effects.
Your code has nothing to do with the fact that
memcpy(), memset(), memmove() and memcmp() are all string functions.
--
pete
Nov 13 '05 #42
On Fri, 26 Sep 2003 16:56:05 GMT, Thomas Matthews
<Th**********************@sbcglobal.net> wrote:
pete wrote:
Thomas Matthews wrote:
ROSY wrote:
1. How would you use the functions memcpy(), memset(), memmove()?

There is also memcmp().

Are you out of your MIND !?
OP's question is CLEARLY only about the string functions
which return type pointer to void, and which have side effects.

Anyway, the answer to the question is here:

http://anubis.dkuug.dk/jtc1/sc22/wg14/www/docs/n869/


FYI, the mem*() functions are not string functions. The string
functions are str*(), and work with NULL terminated character
arrays.

They do have side effects, which is their behavior.

Try this one:
#include <stdio.h>
#include <string.h>

#define BUFFER_LENGTH 64

int main(void)
{
const char * test_text = "How are you?\n\0\nMr. Potato?\n";
char result[BUFFER_LENGTH];
unsigned int i;

memset(result, '\0', 256);


I haven't been following this thread in detail. Was it your intention
to invoke undefined behavior?
/* string test */
strcpy(result, test_text);
for (i = 0; i < BUFFER_LENGTH; ++i)
{
putchar(result[i]);
}

/* memcpy test */
memcpy(result, test_text, sizeof(*test_text));
Was it your intention to copy only 1 byte? Since you did not
reinitialize result, do you expect the value in result to change?
for (i = 0; i < BUFFER_LENGTH; ++i)
{
putchar(result[i]);
}
return 0;
}


<<Remove the del for email>>
Nov 13 '05 #43
"Arthur J. O'Dwyer" <aj*@nospam.andrew.cmu.edu> wrote in message news:<Pi**********************************@unix48. andrew.cmu.edu>...

It is probably not significant that a Google Groups
search on "author:ROSY" suggests the "Related Groups"
of comp.lang.c.* and soc.sexuality.spanking...


In case, if you're not kidding, "author:name" is not the right
Google Groups search term. It should be rather "author:email" or just
"name"

---
"Never give in! Never give in! Never, Never, Never, Never – in
nothing great or small, large or petty – Never give in except to
convictions of honor and good sense." -- Sir Winston Churchill
http://guideme.itgo.com/atozofc/ - "A to Z of C" Project
Email: rrjanbiah-at-Y!com
Nov 13 '05 #44
again spoking ur nose.

ng**********@rediffmail.com (R. Rajesh Jeba Anbiah) wrote in message news:<ab**************************@posting.google. com>...
"Arthur J. O'Dwyer" <aj*@nospam.andrew.cmu.edu> wrote in message news:<Pi**********************************@unix48. andrew.cmu.edu>...

It is probably not significant that a Google Groups
search on "author:ROSY" suggests the "Related Groups"
of comp.lang.c.* and soc.sexuality.spanking...


In case, if you're not kidding, "author:name" is not the right
Google Groups search term. It should be rather "author:email" or just
"name"

---
"Never give in! Never give in! Never, Never, Never, Never ? in
nothing great or small, large or petty ? Never give in except to
convictions of honor and good sense." -- Sir Winston Churchill
http://guideme.itgo.com/atozofc/ - "A to Z of C" Project
Email: rrjanbiah-at-Y!com

Nov 13 '05 #45
r u harlot!!!dont be silly ,ur not at that level atleast.R u meet some plonker
except me????

Joona I Palaste <pa*****@cc.helsinki.fi> wrote in message news:<bl**********@oravannahka.helsinki.fi>...
ROSY <de**************@rediffmail.com> scribbled the following:
U want 2 answer the levels of question,i think ur rubbish again,the questions
fuck urself understand.if u take challenge then i'm going on further.But if u
dont give any response ur jugglery come 2 at an end.
Really ur fooing the bar.


Were you born this ignorant, or did you have to take a course? *PLONK*

Nov 13 '05 #46
ohhh!!! exactly ur plonker to whom???
Default User <fi********@company.com> wrote in message news:<3F***************@company.com>...
ROSY wrote:
Lastly ur really damned.

*plonk*


Brian Rodenborn

Nov 13 '05 #47
On 28 Sep 2003 20:02:15 -0700, in comp.lang.c ,
de**************@rediffmail.com (ROSY) wrote:
again spoking ur nose.


thats "poking your nose". Unless you're planning to turn your nose
into a cartwheel?

--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.angelfire.com/ms3/bchambless0/welcome_to_clc.html>
Nov 13 '05 #48
On 28 Sep 2003 20:08:28 -0700, in comp.lang.c ,
de**************@rediffmail.com (ROSY) wrote:
r u harlot!!!dont be silly ,ur not at that level atleast.R u meet some plonker
except me????


I've no idea what your native tongue is, but that collection of words
above is utterly meaningless.

So, to everyone else...
_____________________
/| /| | |
||__|| | Please do not |
/ O O\__ | feed the |
/ \ | Trolls |
/ \ \|_____________________|
/ _ \ \ ||
/ |\____\ \ ||
/ | | | |\____/ ||
/ \|_|_|/ | _||
/ / \ |____| ||
/ | | | --|
| | | |____ --|
* _ | |_|_|_| | \-/
*-- _--\ _ \ | ||
/ _ \\ | / `
* / \_ /- | | |
* ___ c_c_c_C/ \C_c_c_c____________

--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.angelfire.com/ms3/bchambless0/welcome_to_clc.html>
Nov 13 '05 #49
pete wrote:
Thomas Matthews wrote:
pete wrote:
Thomas Matthews wrote:
ROSY wrote:

>1. How would you use the functions memcpy(),
> memset(), memmove()?

There is also memcmp().
Are you out of your MIND !?
OP's question is CLEARLY only about the string functions
which return type pointer to void, and which have side effects.

Anyway, the answer to the question is here:

http://anubis.dkuug.dk/jtc1/sc22/wg14/www/docs/n869/


FYI, the mem*() functions are not string functions. The string
functions are str*(), and work with NULL terminated character
arrays.

Who told you that ?
N869
7.21 String handling <string.h>
7.21.1 String function conventions
[#1] The header <string.h> declares one type and several
functions, and defines one macro useful for manipulating
arrays of character type and other objects treated as arrays
of character type. The type is size_t and the macro is
NULL (both described in 7.17). Various methods are used for
determining the lengths of the arrays, but in all cases a
char * or void * argument points to the initial (lowest
addressed) character of the array. If an array is accessed
beyond the end of an object, the behavior is undefined.

void* arguments have nothing to do with any functions
that start with str*.


I'm not correlating a void * with string functions.
I'm stating that string functions use the NULL character '\0'
for determining the end of the region whereas the mem*()
function use explicit length parameter for the size.

One exception is strncpy, which copies up to a null character
or until the given number of characters is reached.

They do have side effects, which is their behavior.

memcmp() has no side effects, which is part of the reason
that memcmp() does not belong in the same group
of string functions, as those which OP asked about.


In Harbison & Steele, 3rd edition, the authors differentiate
the str*() functions under string processing and the mem*()
functions under memory functions (of which memcmp is also
listed).

To quote the chapter summary of Chapter 14, Memory Functions:
The facilities in this chapter give the C programmer
efficient ways to copy, compare and set blocks of memory.

String functions are functions that operate on NULL terminated
sequences of characters.

When using the str*() functions for manipulating memory,
they will terminate when an char value of 0x00 is
encountered, whereas the mem*() functions won't.

There's always the issue of whether you are trolling or not.

--
Thomas Matthews

C++ newsgroup welcome message:
http://www.slack.net/~shiva/welcome.txt
C++ Faq: http://www.parashift.com/c++-faq-lite
C Faq: http://www.eskimo.com/~scs/c-faq/top.html
alt.comp.lang.learn.c-c++ faq:
http://www.raos.demon.uk/acllc-c++/faq.html
Other sites:
http://www.josuttis.com -- C++ STL Library book

Nov 13 '05 #50

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
by: Mac | last post by:
$ cat junk27.c #include <stdio.h> #include <string.h> int main (void) { printf("The difference between memcpy and memmove is %ld\n", (long int) memcpy - (long int) memmove); return 0; }
21
by: Method Man | last post by:
Just a few theoretical questions I had on 'memmove': 1. Is there ever a good reason to use memcpy instead of memmove? 2. Is memmove useful to copy structs (as opposed to = operator)? 3. In...
12
by: Ian | last post by:
I read the FAQ about the differences between memcpy() and memmove(). Apparently memmove() is supposed to be safer. Just to make sure I understand the concept of memmove(), can someone tell me if...
6
by: novice | last post by:
Please explain with an example whts the DIFFERENCE between "memcpy" and "memmove"
6
by: wenmang | last post by:
Here is the code which causes core dump when is built differently, 1 for regular dev built, the other for packaging build. class my_class{ public: my_class(){}; ~my_class(){}; private:...
14
by: somenath | last post by:
Hi All, I am trying to understand the behavior of the memcpy and memmove. While doing so I wrote a program as mentioned bellow . #include<stdio.h> #include<stdlib.h> #include<string.h> ...
4
by: gsi | last post by:
Hi all, memmove() is guranteed to work correctly if the objects overlap, I am not sure why this can't be done without any extra condition check in code for the memmove() implementation or...
3
by: Chris | last post by:
Hello all, Not sure if this is off topic, if it is I apologise in advance. Is it safe to use memmove() on an array of objects? I create an array of Objects and I have a cursor to indicate...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.